Advertisement
jarturon55

webpack.dev.js

Jul 10th, 2018
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const webpack = require('webpack');
  2. const writeFilePlugin = require('write-file-webpack-plugin');
  3. const webpackMerge = require('webpack-merge');
  4. const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
  5. const WebpackNotifierPlugin = require('webpack-notifier');
  6. const path = require('path');
  7.  
  8. const utils = require('./utils.js');
  9. const commonConfig = require('./webpack.common.js');
  10.  
  11. const ENV = 'development';
  12.  
  13. module.exports = webpackMerge(commonConfig({
  14.     env: ENV
  15. }), {
  16.     devtool: 'eval-source-map',
  17.     devServer: {
  18.         contentBase: './build/www',
  19.         proxy: [{
  20.             context: [
  21.                 /* jhipster-needle-add-entity-to-webpack - JHipster will add entity api paths here */
  22.                 '/services',
  23.                 '/static/images',
  24.                 '/management',
  25.                 '/swagger-resources',
  26.                 '/v2/api-docs',
  27.                 '/h2-console'
  28.             ],
  29.             target: 'http://localhost:8080',
  30.             secure: false
  31.         }]
  32.     },
  33.     entry: {
  34.         polyfills: './src/main/webapp/app/polyfills',
  35.         global: './src/main/webapp/content/css/global.css',
  36.         main: './src/main/webapp/app/app.main'
  37.     },
  38.     output: {
  39.         path: utils.root('build/www'),
  40.         filename: 'app/[name].bundle.js',
  41.         chunkFilename: 'app/[id].chunk.js'
  42.     },
  43.     module: {
  44.         rules: [{
  45.                 test: /\.ts$/,
  46.                 enforce: 'pre',
  47.                 loaders: 'tslint-loader',
  48.                 exclude: ['node_modules', new RegExp('reflect-metadata\\' + path.sep + 'Reflect\\.ts')]
  49.             },
  50.             {
  51.                 test: /\.ts$/,
  52.                 loaders: [
  53.                     'angular2-template-loader',
  54.                     'awesome-typescript-loader'
  55.                 ],
  56.                 exclude: ['node_modules/generator-jhipster']
  57.             },
  58.             {
  59.                 test: /\.css$/,
  60.                 loaders: ['to-string-loader', 'css-loader'],
  61.                 exclude: /(vendor\.css|global\.css)/
  62.             },
  63.             {
  64.                 test: /(vendor\.css|global\.css)/,
  65.                 loaders: ['style-loader', 'css-loader']
  66.             }
  67.         ]
  68.     },
  69.     plugins: [
  70.         new BrowserSyncPlugin({
  71.             host: 'localhost',
  72.             port: 8900,
  73.             proxy: {
  74.                 target: 'http://localhost:9060'
  75.             }
  76.         }, {
  77.             reload: false
  78.         }),
  79.         new webpack.NoEmitOnErrorsPlugin(),
  80.         new webpack.NamedModulesPlugin(),
  81.         new writeFilePlugin(),
  82.         new webpack.WatchIgnorePlugin([
  83.             utils.root('src/test'),
  84.         ]),
  85.         new WebpackNotifierPlugin({
  86.             title: 'SVSWeb',
  87.             contentImage: path.join(__dirname, 'ncr-logo.png')
  88.         })
  89.     ]
  90. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement