Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
bail: true,
entry: require.resolve('../shims/build'),
output: {
path: hopsConfig.buildDir,
publicPath: '/',
pathinfo: true,
filename: getAssetPath('[name]-[chunkhash:16].js'),
chunkFilename: getAssetPath('[name]-[chunkhash:16].js'),
devtoolModuleFilenameTemplate: function(info) {
return path
.relative(hopsConfig.appDir, info.absoluteResourcePath)
.replace(/\\/g, '/');
},
},
context: hopsConfig.appDir,
resolve: require('../sections/resolve')('build'),
module: {
rules: require('../sections/module-rules')('build'),
},
devtool: 'source-map',
optimization: {
splitChunks: {
chunks: 'all',
},
minimizer: [
new UglifyJSPlugin({
cache: true,
parallel: true,
sourceMap: true,
uglifyOptions: {
output: { comments: false },
exports.getFragmentsFile = function getFragmentsFile() {
return path.join(hopsConfig.appDir, 'fragmentTypes.json');
};
module.exports = {
target: 'node',
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
entry: require.resolve('../shims/node'),
output: {
path: hopsConfig.cacheDir,
publicPath: '/',
pathinfo: true,
filename: 'server.js',
libraryTarget: 'commonjs2',
devtoolModuleFilenameTemplate: function(info) {
return path.resolve(info.absoluteResourcePath).replace(/\\/g, '/');
},
},
context: hopsConfig.appDir,
resolve: require('../sections/resolve')('node'),
externals: [
require('webpack-node-externals')({
modulesDir: modulesDir,
whitelist: shouldIncludeExternalModuleInBundle,
}),
],
module: {
rules: require('../sections/module-rules')('node'),
},
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1,
}),
new webpack.EnvironmentPlugin(
Object.assign(
devtoolModuleFilenameTemplate: function(info) {
return path
.relative(hopsConfig.appDir, info.absoluteResourcePath)
.replace(/\\/g, '/');
},
},
devtoolModuleFilenameTemplate: function(info) {
return path
.relative(hopsConfig.appDir, info.absoluteResourcePath)
.replace(/\\/g, '/');
},
},
module.exports = function getResolveConfig(target) {
var platform = target === 'node' ? 'server' : 'browser';
return {
alias: Object.assign(
{
'hops-entry-point': hopsConfig.appDir,
},
hopsConfig.workerFile && {
'hops-worker-entry-point': hopsConfig.workerFile,
}
),
mainFields: [
'esnext:' + platform,
'jsnext:' + platform,
platform,
'esnext',
'jsnext',
'esnext:main',
'jsnext:main',
'main',
],
modules: ['node_modules'].concat(hopsConfig.moduleDirs),
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
bail: true,
entry: require.resolve('../shims/build'),
output: {
path: hopsConfig.buildDir,
publicPath: '/',
pathinfo: true,
filename: getAssetPath('[name]-[chunkhash:16].js'),
chunkFilename: getAssetPath('[name]-[chunkhash:16].js'),
devtoolModuleFilenameTemplate: function(info) {
return path
.relative(hopsConfig.appDir, info.absoluteResourcePath)
.replace(/\\/g, '/');
},
},
context: hopsConfig.appDir,
resolve: require('../sections/resolve')('build'),
module: {
rules: require('../sections/module-rules')('build'),
},
devtool: 'source-map',
optimization: {
splitChunks: {
cacheGroups: {
commons: {
test: function(module) {
if (module.resource) {
if (
module.resource.indexOf('hops-config') > -1 ||
module.resource.indexOf('.css') === module.resource.length - 4
) {
return false;
mode: 'development',
entry: [
require.resolve('webpack-hot-middleware/client'),
require.resolve('../shims/develop'),
],
output: {
path: hopsConfig.buildDir,
publicPath: '/',
pathinfo: true,
filename: getAssetPath('[name].js'),
chunkFilename: getAssetPath('chunk-[id].js'),
devtoolModuleFilenameTemplate: function(info) {
return path.resolve(info.absoluteResourcePath).replace(/\\/g, '/');
},
},
context: hopsConfig.appDir,
resolve: require('../sections/resolve')('develop'),
module: {
rules: require('../sections/module-rules')('develop'),
},
plugins: [
new ServiceWorkerPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.EnvironmentPlugin(
Object.assign(
{
NODE_ENV: 'development',
},
hopsConfig.envVars
)
),