-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
63 lines (59 loc) · 2.04 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
var packageJSON = require('./package.json');
var path = require('path');
var webpack = require('webpack');
// var webpack = require('./node_modules/.bin/webpack');
var ROOT = path.resolve(__dirname, 'src/main/resources/static');
var SRC = path.resolve(ROOT, 'js');
var DEST = path.resolve(__dirname, 'src/main/resources/static/dist');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const PATHS = {
build: path.join(__dirname, 'target', 'classes', 'META-INF', 'resources', 'webjars', packageJSON.name, packageJSON.version)
};
module.exports = {
entry: {
app: SRC + '/index.jsx',
},
devtool: 'source-map',
output: {
path: DEST,
filename: 'app-bundle.js',
publicPath: '/dist/',
},
module: {
loaders: [
{
test: /\.jsx?$/, // Notice the regex here. We're matching on js and jsx files.
loaders: 'babel-loader',
query: {
presets: ['es2015', 'react']
},
include: SRC
},
{test: /\.css$/, loader: 'style-loader!css-loader'},
{test: /\.less$/, loader: 'style!css!less'},
// Needed for the css-loader when [bootstrap-webpack](https://github.com/bline/bootstrap-webpack)
// loads bootstrap's css.
{test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/font-woff'},
{test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=application/octet-stream'},
{test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: 'file'},
{test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: 'url?limit=10000&mimetype=image/svg+xml'}
],
},
resolve: {
// alias: [
// path.resolve(ROOT, 'js'),
// path.resolve(ROOT, 'css'),
// ],
extensions: ['*', '.js', '.jsx']
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new CopyWebpackPlugin([
{
from: 'node_modules/monaco-editor/min/vs',
to: 'vs',
}
])
],
};