-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
webpack.config.js
77 lines (76 loc) · 2.21 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
var webpack = require('webpack');
var path = require('path');
var autoprefixer = require('autoprefixer');
var UnminifiedWebpackPlugin = require('unminified-webpack-plugin');
module.exports = {
context: __dirname + "/",
entry: [
__dirname + '/app/js/app.babel.jsx'
// 'webpack/hot/dev-server',
],
module: {
preLoaders: [
{
exclude: /src\//,
loader: 'source-map'
}
],
loaders: [
{ test: /\.(json)$/, exclude: /node_modules/, loaders: ['json-loader'] },
{ test: /\.(jsx|.js|babel.jsx|babel.js)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
// {
// test: /\.tag$/,
// loader: 'riotjs-loader',
// type: 'babel',
// exclude: /node_modules/
// },
// { test: /\.jade$/, loaders: ['jade'] },
{ test: /\.(postcss.css)$/, loader: "style-loader!css-loader!postcss-loader" },
{ test: /\.html$/, loader: 'raw-loader' },
{
test: /\.(eot|woff|ttf|svg|png|jpg|wav|mp3)$/,
loader: 'url-loader?limit=30000&name=[name]-[hash].[ext]',
}
]
},
postcss: function () {
return {
defaults: [ require('precss'), require('postcss-cssnext'), require('postcss-modules') ],
cleaner: [autoprefixer({ browsers: ['last 2 versions'] })]
};
},
output: {
path: __dirname + '/app/build/',
filename: 'mojs-curve-editor.min.js',
publicPath: 'build/',
library: 'mojs-curve-editor',
libraryTarget: 'umd',
umdNamedDefine: true,
// hotUpdateChunkFilename: "[id].hot-update.js"
},
plugins: [
// new webpack.ProvidePlugin({
// h: 'preact'
// }),
// new webpack.NoErrorsPlugin(),
// new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin({
compress: { warnings: false }
}),
new UnminifiedWebpackPlugin()
// new webpack.HotModuleReplacementPlugin()
],
// devtool: process.env.NODE_ENV==='production' ? 'source-map' : 'inline-source-map',
resolve: {
root: [ path.resolve('./') ],
moduleDirectories: ['node_modules'],
target: 'node',
extensions: [
'', '.js', '.babel.js', '.babel.jsx',
'.postcss.css', '.css', '.json'
]
}
};