-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
69 lines (64 loc) · 1.87 KB
/
Copy pathwebpack.config.js
File metadata and controls
69 lines (64 loc) · 1.87 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
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const entries = [
'react-hot-loader/patch',
// activate HMR for React
'./src/index.js',
// the entry point of our app
]
let plugins = [
new webpack.HotModuleReplacementPlugin(), // Enable HMR
new webpack.NamedModulesPlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor' // Specify the common bundle's name.
}),
new ExtractTextPlugin('../css/styles.css')
]
if (process.env.REPORT) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'static'
}))
}
module.exports = {
context: path.resolve(__dirname),
devtool: "eval-source-map",
entry: {
main: entries,
vendor: ['onsenui', 'react', 'react-dom', 'react-onsenui']
},
output: {
path: path.resolve(__dirname, 'platforms/android/assets/www/js'),
filename: '[name].js',
publicPath: "/js/"
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: [/node_modules/],
use: ['babel-loader'],
},
{
test: /\.css$/,
use: ExtractTextPlugin.extract({
use: ['css-loader']
})
},
{
test: /\.(ttf|otf|eot|svg|woff(2)?)(\?[a-z0-9]+)?$/,
loader: 'file-loader?name=../assets/[name].[ext]'
}
],
},
devServer: {
contentBase: path.join(__dirname, "platforms/android/assets/www"),
hot: true, // Tell the dev-server we're using HMR,
compress: true,
port: 3000,
publicPath: "/js/",
disableHostCheck: true,
},
plugins: plugins
};