[fix] babel-plugin support for 'react-native-web' module name

Now rewrites import/export/require statements from 'react-native-web'.
Install the plugin in the 'benchmarks' package.
This commit is contained in:
Nicolas Gallagher
2018-01-01 12:01:22 -08:00
parent 46e77d0b00
commit 209bd3aee1
13 changed files with 372 additions and 368 deletions
+10 -9
View File
@@ -1,4 +1,5 @@
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const babelPreset = require('../../scripts/babel/preset');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const path = require('path');
const webpack = require('webpack');
@@ -25,23 +26,23 @@ module.exports = {
},
{
test: /\.js$/,
include: [
path.resolve(appDirectory, 'src'),
],
include: [path.resolve(appDirectory, 'src')],
use: {
loader: 'babel-loader',
options: {
cacheDirectory: true
cacheDirectory: true,
presets: babelPreset,
plugins: ['react-native-web']
}
}
}
]
},
plugins: [
// new BundleAnalyzerPlugin({
// analyzerMode: 'static',
// openAnalyzer: false
// }),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),