mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-16 04:10:30 +00:00
59 lines
1.2 KiB
JavaScript
59 lines
1.2 KiB
JavaScript
const BundleAnalyzerPlugin =
|
|
require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
|
const path = require('path');
|
|
|
|
const appDirectory = path.resolve(__dirname);
|
|
|
|
module.exports = {
|
|
mode: 'production',
|
|
context: __dirname,
|
|
entry: './src/index',
|
|
output: {
|
|
path: path.resolve(appDirectory, 'dist'),
|
|
filename: 'bundle.js'
|
|
},
|
|
optimization: {
|
|
minimize: process.env.NODE_ENV === 'production'
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.css$/,
|
|
use: [
|
|
'style-loader',
|
|
{
|
|
loader: 'css-loader',
|
|
options: {
|
|
modules: {
|
|
localIdentName: '[hash:base64:8]'
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
test: /\.js$/,
|
|
include: [path.resolve(appDirectory, 'src')],
|
|
use: {
|
|
loader: 'babel-loader',
|
|
options: {
|
|
cacheDirectory: false,
|
|
extends: path.resolve(appDirectory, '../../configs/babel.config')
|
|
}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
plugins: [
|
|
new BundleAnalyzerPlugin({
|
|
analyzerMode: 'static',
|
|
openAnalyzer: false
|
|
})
|
|
],
|
|
resolve: {
|
|
alias: {
|
|
'react-native': 'react-native-web'
|
|
}
|
|
}
|
|
};
|