forked from nhn/tui.calendar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
93 lines (91 loc) · 2.71 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
86
87
88
89
90
91
92
93
/* eslint-env es6 */
/* eslint strict: 0, no-process-env: 0 */
var pkg = require('./package.json');
var path = require('path');
var webpack = require('webpack');
var stylus = require('stylus');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var SafeUmdPlugin = require('safe-umd-webpack-plugin');
var isProduction = process.env.NODE_ENV === 'production';
var FILENAME = pkg.name + (isProduction ? '.min' : '');
var BANNER = [
FILENAME,
'@version ' + pkg.version + ' | ' + new Date().toDateString(),
'@author ' + pkg.author,
'@license ' + pkg.license
].join('\n');
var context = JSON.stringify({
CSS_PREFIX: 'tui-full-calendar-',
BUNDLE_TYPE: (isProduction ? 'Release' : 'Debug')
});
var stylusLoader = ExtractTextPlugin.extract('style', `preprocess?${context}!css?sourceMap!stylus?sourceMap!`);
var jsLoader = `preprocess?${context}`;
var devtool = '#source-map';
module.exports = {
eslint: {
failOnError: isProduction
},
entry: './src/index.js',
output: {
library: ['tui', 'Calendar'],
libraryTarget: 'umd',
path: path.join(__dirname, 'dist'),
filename: FILENAME + '.js',
publicPath: '/dist'
},
externals: {
'tui-code-snippet': {
'commonjs': 'tui-code-snippet',
'commonjs2': 'tui-code-snippet',
'amd': 'tui-code-snippet',
'root': ['tui', 'util']
},
'tui-date-picker': {
'commonjs': 'tui-date-picker',
'commonjs2': 'tui-date-picker',
'amd': 'tui-date-picker',
'root': ['tui', 'DatePicker']
},
'tui-time-picker': {
'commonjs': 'tui-time-picker',
'commonjs2': 'tui-time-picker',
'amd': 'tui-time-picker',
'root': ['tui', 'TimePicker']
}
},
module: {
loaders: [{
test: /\.hbs$/,
loader: 'handlebars-template'
}, {
test: /\.styl$/,
loader: stylusLoader
}, {
test: /\.js$/,
loader: jsLoader,
exclude: /node_modules|bower_components/
}, {
test: /\.css$/,
loader: stylusLoader,
include: path.join(__dirname, 'src/css/main.styl')
}]
},
stylus: {
define: {
url: stylus.url({paths: [path.join(__dirname, 'src/css/image')]})
}
},
devtool,
plugins: [
new ExtractTextPlugin(FILENAME + '.css'),
new webpack.BannerPlugin(BANNER, {entryOnly: true}),
new SafeUmdPlugin()
],
devServer: {
historyApiFallback: false,
progress: true,
inline: true,
host: '0.0.0.0',
disableHostCheck: true
}
};