Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
minify: true,
// For unknown URLs, fallback to the index page
navigateFallback: `${publicUrl}/index.html`,
// Ignores URLs starting from /__ (useful for Firebase):
// https://github.com/facebookincubator/create-react-app/issues/2237#issuecomment-302693219
navigateFallbackWhitelist: [/^(?!\/__).*/],
// Don't precache sourcemaps (they're large) and build asset manifest:
staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
}),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
};
]),
// css files from the extract-text-plugin loader
// new ExtractTextPlugin('[name]-[chunkhash].css', {allChunks: false}),
extractSASS,
new webpack.DefinePlugin({
__CLIENT__: true,
__SERVER__: false,
__DEVELOPMENT__: false,
__DEVTOOLS__: false,
'process.env': {
// Useful to reduce the size of client-side libraries, e.g. react
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.IgnorePlugin(/\.\/dev/, /\/config$/),
// optimizations
new webpack.optimize.DedupePlugin(),
new webpack.optimize.CommonsChunkPlugin({
name: 'commons',
filename: 'commons.js'
}),
webpackIsomorphicToolsPlugin
],
progress: true,
module: {
loaders: [
{
test: /\.scss$/,
loader: extractSASS.extract('style', ['css', 'resolve-url', 'sass'])
// loaders: ['style', 'css', 'resolve-url', 'sass'])
new webpack.HotModuleReplacementPlugin(),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebookincubator/create-react-app/issues/240
new CaseSensitivePathsPlugin(),
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for Webpack to discover it. This plugin
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebookincubator/create-react-app/issues/186
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
// Turn off performance hints during development because we don't do any
// splitting or minification in interest of speed. These warnings become
// cumbersome.
performance: {
hints: false,
},
}),
// new UglifyJsPlugin({
// cacheFolder: path.resolve(__dirname, 'cache/'),
// debug: true,
// include: /\.min\.js$/,
// minimize: true,
// sourceMap: true,
// output: {
// comments: false
// },
// compressor: {
// warnings: false
// }
// }),
new JasmineWebpackPlugin(),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
jquery: "jquery"
})
]
};
context: __dirname
}
}),
// hot reload
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DllPlugin({
name: '[name]',
path: path.join(assetsPath, '[name]-manifest.json')
}),
new webpack.ProvidePlugin({
React: 'react',
ReactDOM: 'react-dom'
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new webpack.IgnorePlugin(/webpack-stats\.json$/),
new webpack.DefinePlugin({
__CLIENT__: true,
__SERVER__: false,
__DEVELOPMENT__: true,
__DEVTOOLS__: true // <-------- DISABLE redux-devtools HERE
}),
webpackIsomorphicToolsPlugin.development()
]
};
// `annotation: true` appends the sourceMappingURL to the end of
// the css file, helping the browser find the sourcemap
annotation: true
}
: false
}
})
]
}
const plugins = [
new webpack.DefinePlugin({
'__isBrowser__': true // eslint-disable-line
}),
new ModuleNotFoundPlugin(paths.appPath),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new ManifestPlugin({
fileName: 'asset-manifest.json',
publicPath: publicPath
})
]
if (process.env.npm_config_report === 'true') {
plugins.push(new BundleAnalyzerPlugin())
}
module.exports = merge(baseConfig, {
devtool: devtool,
entry: {
Page: ['@babel/polyfill', paths.entry]
},
resolve: {
new webpack.HotModuleReplacementPlugin(),
// Watcher doesn't work well if you mistype casing in a path so we use
// a plugin that prints an error when you attempt to do this.
// See https://github.com/facebook/create-react-app/issues/240
new CaseSensitivePathsPlugin(),
// If you require a missing module and then `npm install` it, you still have
// to restart the development server for Webpack to discover it. This plugin
// makes the discovery automatic so you don't have to restart.
// See https://github.com/facebook/create-react-app/issues/186
new WatchMissingNodeModulesPlugin(paths.appNodeModules),
// Moment.js is an extremely popular library that bundles large locale files
// by default due to how Webpack interprets its code. This is a practical
// solution that requires the user to opt into importing specific locales.
// https://github.com/jmblog/how-to-optimize-momentjs-with-webpack
// You can remove this if you don't use Moment.js:
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// Generate a manifest file which contains a mapping of all asset filenames
// to their corresponding output file so that tools can pick it up without
// having to parse `index.html`.
new ManifestPlugin({
fileName: 'asset-manifest.json',
publicPath,
}),
],
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
dgram: 'empty',
fs: 'empty',
net: 'empty',
tls: 'empty',
{
test: /\.svg/,
use: ['svg-inline-loader']
}
]
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.svg']
},
devtool: !env.production ? 'inline-source-map' : undefined,
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'media')
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new TSLintPlugin({
files: ['./src/**/*.ts']
})
]
};
return webview;
}
{
test: /\.ts$/,
loader: 'ts'
},
{
test: /\.html/,
loader: 'html'
},
{
test: /\.css$/,
loader: 'css'
}
]
},
plugins: [
new webpack.IgnorePlugin(/^@angular/),
new webpack.IgnorePlugin(/^rxjs/),
new webpack.NoErrorsPlugin(),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin()
]
};