-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.js
113 lines (105 loc) · 2.54 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const SRC_CONTEXT = path.join(__dirname, 'src');
const BIN_CONTEXT = path.join(__dirname, 'dist');
module.exports = {
devtool: 'source-map',
resolve: {
modules: ['node_modules', 'src/js'],
descriptionFiles: ['package.json'],
mainFields: ['browser', 'main'],
mainFiles: ['index'],
},
entry: {
realizejs: path.resolve(SRC_CONTEXT, 'index.js'),
},
output: {
path: path.resolve(BIN_CONTEXT, 'build'),
filename: '[name].js',
chunkFilename: '[id].realizejs.js',
library: 'Realize',
libraryTarget: 'umd',
},
externals: {
jquery: {
commonjs: 'jquery',
commonjs2: 'jquery',
amd: 'jquery',
window: '$',
root: '$',
},
lodash: {
commonjs: 'lodash',
commonjs2: 'lodash',
amd: 'lodash',
window: '_',
root: '_',
},
'materialize-css': {
commonjs: 'materialize-css',
commonjs2: 'materialize-css',
amd: 'materialize-css',
window: 'Materialize',
root: 'Materialize',
},
moment: {
commonjs: 'moment',
commonjs2: 'moment',
amd: 'moment',
window: 'moment',
root: 'moment',
},
numeral: {
commonjs: 'numeral',
commonjs2: 'numeral',
amd: 'numeral',
window: 'numeral',
root: 'numeral',
},
react: {
commonjs: 'react',
commonjs2: 'react',
amd: 'react',
window: 'React',
root: 'React',
},
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react-dom',
amd: 'react-dom',
window: 'ReactDOM',
root: 'ReactDOM',
},
'react-addons-css-transition-group': {
commonjs: 'react-addons-css-transition-group',
commonjs2: 'react-addons-css-transition-group',
amd: 'react-addons-css-transition-group',
root: ['React', 'addons', 'CSSTransitionGroup'],
},
},
module: {
rules: [
{
test: /\.s(a|c)ss$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: [
{ loader: 'css-loader', options: { importLoaders: 1 } },
{ loader: 'sass-loader' },
],
}),
},
{
test: /\.js[x]?$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
],
},
plugins: [
new ExtractTextPlugin('realizejs.css'),
new webpack.IgnorePlugin(/\.\/locale/, /moment/),
new webpack.IgnorePlugin(/\.\/locales/, /numeral/),
],
};