mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-31 09:44:21 +00:00
Update webpack
This commit is contained in:
@@ -23,8 +23,7 @@ module.exports = {
|
|||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
|
||||||
'process.env.__REACT_NATIVE_DEBUG_ENABLED__': DEV
|
'process.env.__REACT_NATIVE_DEBUG_ENABLED__': DEV
|
||||||
}),
|
})
|
||||||
new webpack.optimize.OccurenceOrderPlugin()
|
|
||||||
],
|
],
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|||||||
+4
-4
@@ -52,16 +52,16 @@
|
|||||||
"eslint-config-prettier": "^1.6.0",
|
"eslint-config-prettier": "^1.6.0",
|
||||||
"eslint-plugin-promise": "^3.5.0",
|
"eslint-plugin-promise": "^3.5.0",
|
||||||
"eslint-plugin-react": "^6.10.3",
|
"eslint-plugin-react": "^6.10.3",
|
||||||
"file-loader": "^0.9.0",
|
"file-loader": "^0.11.1",
|
||||||
"jest": "^19.0.2",
|
"jest": "^19.0.2",
|
||||||
"node-libs-browser": "^0.5.3",
|
"node-libs-browser": "^0.5.3",
|
||||||
"prettier": "^1.0.2",
|
"prettier": "^1.0.2",
|
||||||
"react": "~15.4.1",
|
"react": "~15.4.1",
|
||||||
"react-addons-test-utils": "~15.4.1",
|
"react-addons-test-utils": "~15.4.1",
|
||||||
"react-test-renderer": "~15.4.1",
|
"react-test-renderer": "~15.4.1",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.8",
|
||||||
"webpack": "^1.13.2",
|
"webpack": "^2.3.3",
|
||||||
"webpack-bundle-analyzer": "^2.2.1"
|
"webpack-bundle-analyzer": "^2.4.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "~15.4.1"
|
"react": "~15.4.1"
|
||||||
|
|||||||
+12
-10
@@ -2,8 +2,8 @@ const path = require('path')
|
|||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||||
|
|
||||||
const SRC_DIRECTORY = './src'
|
const SRC_DIRECTORY = path.resolve(__dirname, 'src');
|
||||||
const DIST_DIRECTORY = './dist'
|
const DIST_DIRECTORY = path.resolve(__dirname, 'dist');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: SRC_DIRECTORY,
|
entry: SRC_DIRECTORY,
|
||||||
@@ -18,17 +18,21 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{
|
{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'babel-loader',
|
use: {
|
||||||
query: { cacheDirectory: true }
|
loader: 'babel-loader',
|
||||||
|
query: { cacheDirectory: true }
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(gif|jpe?g|png|svg)$/,
|
test: /\.(gif|jpe?g|png|svg)$/,
|
||||||
loader: 'url-loader',
|
use: {
|
||||||
query: { name: '[name].[ext]' }
|
loader: 'url-loader',
|
||||||
|
query: { name: '[name].[ext]' }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -44,14 +48,12 @@ module.exports = {
|
|||||||
openAnalyzer: false
|
openAnalyzer: false
|
||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }),
|
||||||
new webpack.optimize.DedupePlugin(),
|
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
new webpack.optimize.UglifyJsPlugin({
|
||||||
compress: {
|
compress: {
|
||||||
dead_code: true,
|
dead_code: true,
|
||||||
drop_console: true,
|
drop_console: true,
|
||||||
screw_ie8: true,
|
screw_ie8: true,
|
||||||
warnings: true
|
warnings: false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user