-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathwebpack.config.js
More file actions
91 lines (86 loc) · 2 KB
/
webpack.config.js
File metadata and controls
91 lines (86 loc) · 2 KB
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
'use strict';
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const process = require('process');
const config = {
entry: {
app: [
'imports?exports=>false&module=>false!webcom',
'babel-polyfill',
'script!html2canvas',
'react',
'./src/assets/images/test.jpg',
'react-dom',
'./src/index'
]
},
output: {
path: path.join(__dirname, './dist'),
filename: 'feedy.js',
publicPath: process.env.PUBLIC_PATH || '/',
libraryTarget: 'umd',
library: 'feedy'
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.css'],
root: __dirname,
modulesDirectories: ['node_modules', 'src'],
alias: {
jquery: 'jquery/dist/jquery.min.js',
webcom: 'webcom/webcom.js'
}
},
module: {
loaders: [
{ test: /\.js/, loaders: ['babel'], exclude: /node_modules/ },
{ test: /\.jpg$/, loader: 'file?name=[name].[ext]'},
{ test: /\.less/, loaders: [ 'style', 'css?sourceMap', 'less?sourceMap' ]}
],
noParse: [
/react\.min\.js$/,
/jquery\.min\.js$/,
/bootstrap\.min\.js$/
]
},
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html',
inject: 'head'
}),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.DefinePlugin({
__DEVTOOLS__: process.env.NODE_ENV !== 'production',
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
],
progress: true,
target: 'web'
};
if (process.env.NODE_ENV !== 'production') {
config.entry.app = [
'./hotReload',
'webpack/hot/dev-server'
].concat(config.entry.app);
config.module.loaders = config.module.loaders.concat([
{ test: /\.css/, loaders: [
'style',
'css?sourceMap&modules'
]}
]);
config.devtool = 'source-map';
config.debug = true;
} else {
config.module.loaders = config.module.loaders.concat([
{ test: /\.css/, loaders:[
'style',
'css-loader?minimize&modules'
]}
]);
config.debug = false;
}
module.exports = config;