diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-06-01 19:47:08 -0400 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-06-01 19:47:08 -0400 |
| commit | 3e72bfa56c860826429a842f6c128d78d4a930db (patch) | |
| tree | 3cecd31c92d53fae32e9761b80802c82f3dcb7fa /client/web/vendor.webpack.config.js | |
| parent | b694bd511ceccd00d4a4c98f36f910d5fc5f79c4 (diff) | |
react-native-web port of fmf app
Diffstat (limited to 'client/web/vendor.webpack.config.js')
| -rw-r--r-- | client/web/vendor.webpack.config.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/client/web/vendor.webpack.config.js b/client/web/vendor.webpack.config.js new file mode 100644 index 0000000..d9cd190 --- /dev/null +++ b/client/web/vendor.webpack.config.js @@ -0,0 +1,56 @@ +// @flow +/* eslint-disable import/no-extraneous-dependencies, global-require, import/no-dynamic-require */ +/* eslint-disable no-underscore-dangle */ +const __DEV__ = process.env.NODE_ENV === 'development' + +const path = require('path') +const webpack = require('webpack') +const config = require('./shared.webpack.config.js') + +// We need a separate build for dev, which is unminified and includes PropTypes. +const outputPath = path.join(__dirname, __DEV__ ? 'vendor-dev' : 'vendor') +const outputFilename = __DEV__ ? '[name].dll.js' : '[name]-[hash:16].dll.js' + +const plugins = [ + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV), + __DEV__, + }), + + ...(__DEV__ ? [] : config.productionPlugins), + + new webpack.DllPlugin({ + name: '[name]', + path: path.join(outputPath, '[name]-manifest.json'), + }), +] + +module.exports = { + entry: { + // Put react-native-web / react dependencies in here. + 'react': [ + 'react-native-web', + ], + // Put any other other core libs in here. (immutable, redux, localforage, etc.) + // 'core': [ + // ], + }, + output: { + filename: outputFilename, + path: outputPath, + library: '[name]', + }, + + module: { + noParse: /localforage\/dist\/localforage.js/, + loaders: config.loaders, + }, + + plugins, + resolve: { + alias: { + 'react-native': 'react-native-web', + }, + extensions: ['.web.js', '.js', '.json'], + }, +} |
