mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-03-27 01:34:17 +08:00
58 lines
1.2 KiB
JavaScript
58 lines
1.2 KiB
JavaScript
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
const path = require('path');
|
|
const webpack = require('webpack');
|
|
|
|
module.exports = {
|
|
context: __dirname,
|
|
entry: './index',
|
|
output: {
|
|
path: path.resolve(__dirname, 'dist'),
|
|
filename: 'performance.bundle.js'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css$/,
|
|
use: [
|
|
'style-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: { module: true, localIdentName: '[hash:base64:8]' }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
exclude: /node_modules/,
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: true
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new BundleAnalyzerPlugin({
|
|
analyzerMode: 'static',
|
|
openAnalyzer: false
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
'process.env.NODE_ENV': JSON.stringify('production')
|
|
}),
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
compress: {
|
|
dead_code: true,
|
|
screw_ie8: true,
|
|
warnings: false
|
|
}
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'react-native': path.join(__dirname, '../src')
|
|
}
|
|
}
|
|
};
|