webpack.config.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright (c) Jupyter Development Team.
  2. // Distributed under the terms of the Modified BSD License.
  3. // Support for Node 0.10
  4. // See https://github.com/webpack/css-loader/issues/144
  5. require('es6-promise').polyfill();
  6. var webpack = require('webpack');
  7. var ExtractTextPlugin = require('extract-text-webpack-plugin');
  8. var findImports = require('find-imports');
  9. console.log('Generating config...');
  10. // Get the list of vendor files.
  11. var VENDOR_FILES = findImports('../lib/**/*.js', { flatten: true });
  12. console.log('Generating bundles...');
  13. module.exports = {
  14. entry: {
  15. jupyterlab: './index.js',
  16. vendor: VENDOR_FILES
  17. },
  18. output: {
  19. path: __dirname + '/build',
  20. filename: '[name].bundle.js',
  21. publicPath: './lab/'
  22. },
  23. node: {
  24. fs: 'empty'
  25. },
  26. debug: true,
  27. bail: true,
  28. devtool: 'source-map',
  29. module: {
  30. loaders: [
  31. { test: /\.css$/,
  32. loader: ExtractTextPlugin.extract("style-loader", "css-loader", {
  33. publicPath: './'
  34. })
  35. },
  36. { test: /\.json$/, loader: 'json-loader' },
  37. { test: /\.html$/, loader: 'file-loader' },
  38. // jquery-ui loads some images
  39. { test: /\.(jpg|png|gif)$/, loader: 'file-loader' },
  40. // required to load font-awesome
  41. { test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
  42. { test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/font-woff' },
  43. { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream' },
  44. { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file-loader' },
  45. { test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url-loader?limit=10000&mimetype=image/svg+xml' }
  46. ]
  47. },
  48. plugins: [
  49. new ExtractTextPlugin('[name].css'),
  50. new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js')
  51. ]
  52. }