BVB Source Codes

mongo-express Show webpack.config.js Source code

Return Download mongo-express: download webpack.config.js Source code - Download mongo-express Source code - Type:.js
  1. 'use strict';
  2.  
  3. const webpack = require('webpack');
  4. const path = require('path');
  5. const AssetsPlugin = require('assets-webpack-plugin');
  6. const CleanWebpackPlugin = require('clean-webpack-plugin');
  7. const CopyWebpackPlugin = require('copy-webpack-plugin');
  8.  
  9. const env = process.env.NODE_ENV || 'development';
  10. const isDev = env === 'development';
  11. const isProd = !isDev;
  12.  
  13. const fileSuffix = isDev ? '' : '-[chunkhash].min';
  14.  
  15. function resolveModulePath(name) {
  16.   const packageJson = '/package.json';
  17.   return require.resolve(`${name}${packageJson}`).replace(packageJson, '');
  18. }
  19.  
  20. const codemirrorPath = resolveModulePath('codemirror');
  21. const bootstrapPath = resolveModulePath('bootstrap');
  22.  
  23. module.exports = {
  24.   entry: {
  25.     index: './lib/scripts/index.js',
  26.     database: './lib/scripts/database.js',
  27.     collection: './lib/scripts/collection.js',
  28.     document: './lib/scripts/document.js',
  29.     gridfs: './lib/scripts/gridfs.js',
  30.  
  31.     vendor: './lib/scripts/vendor.js',
  32.     codemirror: './lib/scripts/codeMirrorLoader.js',
  33.   },
  34.   output: {
  35.     filename: `[name]${fileSuffix}.js`,
  36.     path: path.join(__dirname, 'build'),
  37.     publicPath: 'public/',
  38.   },
  39.  
  40.   module: {
  41.     loaders: [
  42.       {
  43.         test: /.js$/,
  44.         loader: 'babel-loader',
  45.         exclude: /(node_modules)/,
  46.         query: {
  47.           presets: ['es2015'],
  48.         },
  49.       },
  50.     ],
  51.   },
  52.  
  53.   plugins: [
  54.     new CleanWebpackPlugin(['build']),
  55.  
  56.     new webpack.DefinePlugin({
  57.       'process.env.NODE_ENV': JSON.stringify(env),
  58.       __DEV__: isDev,
  59.     }),
  60.  
  61.     new webpack.optimize.CommonsChunkPlugin({
  62.       names: ['codemirror', 'vendor'],
  63.       filename: `[name]${fileSuffix}.js`,
  64.     }),
  65.  
  66.     isProd && (new webpack.optimize.UglifyJsPlugin()),
  67.     isProd && (new webpack.optimize.OccurrenceOrderPlugin(true)),
  68.  
  69.     new CopyWebpackPlugin([
  70.       { from: 'public/images/*', to: 'img/[name].[ext]' },
  71.       { from: 'public/stylesheets/*', to: 'css/[name].[ext]' },
  72.  
  73.       { from: `${codemirrorPath}/lib/codemirror.css`, to: 'css/[name].[ext]' },
  74.       { from: `${codemirrorPath}/theme/*`, to: 'css/theme/[name].[ext]' },
  75.  
  76.       { from: `${bootstrapPath}/dist/fonts/*`, to: 'fonts/[name].[ext]' },
  77.       { from: `${bootstrapPath}/dist/css/bootstrap.min.css`, to: 'css/[name].[ext]' },
  78.       { from: `${bootstrapPath}/dist/css/bootstrap.min.css.map`, to: 'css/[name].[ext]' },
  79.       { from: `${bootstrapPath}/dist/css/bootstrap-theme.min.css`, to: 'css/[name].[ext]' },
  80.       { from: `${bootstrapPath}/dist/css/bootstrap-theme.min.css.map`, to: 'css/[name].[ext]' },
  81.     ]),
  82.  
  83.     new AssetsPlugin({ filename: 'build-assets.json' }),
  84.   ].filter(n => !!n),
  85. };
  86.  
downloadwebpack.config.js Source code - Download mongo-express Source code
Related Source Codes/Software:
XCL-Charts - Android charting libraries (XCL-Charts is a free c... 2017-05-17
scrollMonitor - A simple and fast API to monitor elements as you s... 2017-05-16
XCDYouTubeKit - YouTube video player for iOS, tvOS and macOS 2017-05-16
rails-erd - Generate Entity-Relationship Diagrams for Rails ap... 2017-05-16
np - A better `npm publish` 2017-05-16
kaminari - A Scope & Engine based, clean, powerful, custo... 2017-06-04
python-fire - Python Fire is a library for automatically generat... 2017-06-04
Dapper - Dapper - a simple object mapper for .Net 2017-06-05
pkg - Package your Node.js project into an executable ... 2017-06-05
packer - Packer is a tool for creating identical machine im... 2017-06-05
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top