forked from nhn/tui.image-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
85 lines (81 loc) · 2.29 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
78
79
80
81
82
83
84
85
/**
* webpack.config.js created on 2016. 12. 01.
* @author NHN Ent. FE Development Lab <[email protected]>
*/
const pkg = require('./package.json');
const webpack = require('webpack');
const SafeUmdPlugin = require('safe-umd-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const isProduction = process.argv.indexOf('-p') > -1;
const FILENAME = pkg.name + (isProduction ? '.min' : '');
const BANNER = [
`${FILENAME}.js`,
`@version ${pkg.version}`,
`@author ${pkg.author}`,
`@license ${pkg.license}`
].join('\n');
module.exports = {
eslint: {
failOnError: isProduction
},
entry: './src/index.js',
output: {
library: ['tui', 'ImageEditor'],
libraryTarget: 'umd',
path: 'dist',
publicPath: 'dist',
filename: `${FILENAME}.js`
},
externals: {
'tui-code-snippet': {
'commonjs': 'tui-code-snippet',
'commonjs2': 'tui-code-snippet',
'amd': 'tui-code-snippet',
'root': ['tui', 'util']
},
'tui-color-picker': {
'commonjs': 'tui-color-picker',
'commonjs2': 'tui-color-picker',
'amd': 'tui-color-picker',
'root': ['tui', 'colorPicker']
},
'fabric': {
'commonjs': ['fabric', 'fabric'],
'commonjs2': ['fabric', 'fabric'],
'amd': 'fabric',
'root': 'fabric'
}
},
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'eslint-loader'
}
],
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel'
},
{
test: /\.styl$/,
loader: ExtractTextPlugin.extract('css-loader?sourceMap!stylus-loader?paths=src/css/')
}
]
},
plugins: [
new webpack.BannerPlugin(BANNER),
new ExtractTextPlugin(`${FILENAME}.css`),
new SafeUmdPlugin()
],
devServer: {
historyApiFallback: false,
progress: true,
inline: true,
host: '0.0.0.0',
disableHostCheck: true
}
};