blob: 72a483724a46a0b36bbfee17c32b82429f405ef3 [file] [log] [blame]
Michael Landoefa037d2017-02-19 12:57:33 +02001var webpack = require('webpack');
2var path = require('path');
3
4var PATHS = {
5 SRC: path.resolve(__dirname, 'src/main/webapp'),
6 TARGET: path.resolve(__dirname, 'dist')
7};
8
9var devmode = (process.env.npm_lifecycle_event === 'start');
10
11var entry = [];
12if (devmode) {
13 entry.push('babel-polyfill');
14 entry.push(path.resolve(PATHS.SRC, 'lib/main.jsx'));
15} else {
16 entry.push(path.resolve(PATHS.SRC, 'lib/ecomp/asdc/sequencer/Sequencer.jsx'));
17}
18
19var config = {
20 entry: entry,
21 output: {
22 path: PATHS.TARGET,
23 filename: 'index.js',
24 libraryTarget: 'umd'
25 },
26 resolve: {
svishnev10c74ee2018-01-22 08:43:04 +020027 extensions: ['.js', '.jsx']
Michael Landoefa037d2017-02-19 12:57:33 +020028 },
29 devtool: 'eval-source-map',
30 module: {
svishnev10c74ee2018-01-22 08:43:04 +020031 rules: [
32 {test: /\.(js|jsx)$/, loader: 'eslint-loader', exclude: [/node_modules/], enforce: 'pre'},
33 {test: /\.(js|jsx)$/, loader: 'babel-loader',
34 exclude: /node_modules/,
35 include: path.join(PATHS.SRC, 'lib')},
36 {test: /\.(css)$/, use: [
37 {loader: 'style-loader'},
38 {loader: 'css-loader'}]},
39 {test: /\.(png|woff|woff2|eot|ttf|otf)$/, loader: 'url-loader?limit=100000'},
40 {
41 test: /\.scss$/,
42 include: path.join(PATHS.SRC, 'res'),
43 loaders: ['style-loader', 'css-loader', 'sass-loader']
44 },
45 {
46 test: /\.html$/,
47 include: path.join(PATHS.SRC, 'lib'),
48 loaders: ['raw-loader']
49 },
50 {
51 test: /\.json$/,
52 include: path.join(PATHS.SRC, 'lib'),
53 loaders: ['json-loader']
54 },
55 {
56 test: /\.svg$/,
57 loader: 'svg-sprite-loader?' + JSON.stringify({
58 name: '[name]_[hash]',
59 prefixize: true
60 })
61 }
62 ]
Michael Landoefa037d2017-02-19 12:57:33 +020063 },
64 externals: (devmode ? {} : {
65 'd3': 'd3',
66 'lodash': 'lodash',
67 'react': 'react',
68 'react-dnd': 'react-dnd',
69 'react-dnd-html5-backend': 'react-dnd-html5-backend',
70 'react-dom': 'react-dom',
71 'react-redux': 'react-redux',
72 'react-select': 'react-select',
73 'redux': 'redux'
74 }),
75 devServer: {
76 port: 4096,
77 quiet: false,
78 contentBase: 'src/main/webapp',
79 proxy: {
80 '/services/*': {
81 target: 'http://localhost:38080/asdc-sequencer',
82 secure: false
83 }
84 }
svishnev10c74ee2018-01-22 08:43:04 +020085 },
86 plugins: [
87 new webpack.DefinePlugin({
88 DEV: true,
89 DEBUG: true
90 }),
91 new webpack.HotModuleReplacementPlugin(),
92 new webpack.LoaderOptionsPlugin({
93 options: {
94 eslint: {
95 failOnWarning: false,
96 failOnError: false,
97 configFile: 'eslintrc.json'
98 },
99 context: '/'
100 }
101 })
102 ]
Michael Landoefa037d2017-02-19 12:57:33 +0200103};
104
105module.exports = config;