Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
"lessLoader": {
"sourceMap": false
},
"context": ""
}
}));
if (isProd) {
plugins.push(new HashedModuleIdsPlugin({
"hashFunction": "md5",
"hashDigest": "base64",
"hashDigestLength": 4
}));
plugins.push(new AotPlugin({
"mainPath": "main.ts",
"hostReplacementPaths": {
"environments/index.ts": "environments/index.prod.ts"
},
"exclude": [],
"tsConfigPath": "src/tsconfig.app.json"
}));
// plugins.push(new UglifyJsPlugin({
// "mangle": {
// "screw_ie8": true
// },
// "compress": {
// "screw_ie8": true,
// "warnings": false
// },
// Also dedupe multiple slashes into single ones.
return `/${baseHref || ''}/${deployUrl || ''}/${URL}`.replace(/\/\/+/g, '/');
}
})
],
"sassLoader": {
"sourceMap": false,
"includePaths": []
},
"lessLoader": {
"sourceMap": false
},
"context": ""
}
}),
new AotPlugin({
"mainPath": "main.ts",
"exclude": [],
"tsConfigPath": "src/tsconfig.app.json",
"skipCodeGeneration": env.aot
}),
new NormalModuleReplacementPlugin(
/environments\/environment/,
env.env && env.env != 'dev' ? resolve('src', `environments/environment.${env.env}.ts`) : resolve('src', "environments/environment.ts")
)
],
"node": {
"fs": "empty",
"global": true,
"crypto": "empty",
"tls": "empty",
"net": "empty",
context: ""
}
})
);
if (isProd) {
// plugins.push(
// new HashedModuleIdsPlugin({
// hashFunction: "md5",
// hashDigest: "base64",
// hashDigestLength: 4
// })
// );
plugins.push(
new AotPlugin({
mainPath: "main.ts",
hostReplacementPaths: {
"environments/index.ts": "environments/index.prod.ts"
},
exclude: [],
tsConfigPath: "src/tsconfig.app.json",
skipCodeGeneration: true
})
);
// plugins.push(
// new UglifyJsPlugin({
// test: /\.js($|\?)/i
// })
// );
} else {
return new webpack_1.AngularCompilerPlugin(pluginOptions);
}
else {
const pluginOptions = Object.assign({}, {
mainPath: path.join(projectRoot, appConfig.root, appConfig.main),
i18nFile: buildOptions.i18nFile,
i18nFormat: buildOptions.i18nFormat,
locale: buildOptions.locale,
replaceExport: appConfig.platform === 'server',
missingTranslation: buildOptions.missingTranslation,
hostReplacementPaths,
sourceMap: buildOptions.sourcemaps,
// If we don't explicitely list excludes, it will default to `['**/*.spec.ts']`.
exclude: []
}, options);
return new webpack_1.AotPlugin(pluginOptions);
}
}
function getNonAotConfig(wco) {
{ from: mainSheet },
{ from: "css/**" },
{ from: "fonts/**" },
{ from: "**/*.jpg" },
{ from: "**/*.png" },
{ from: "**/*.xml" },
], { ignore: ["App_Resources/**"] }),
// Generate a bundle starter script and activate it in package.json
new nsWebpack.GenerateBundleStarterPlugin([
"./vendor",
"./bundle",
]),
// Angular AOT compiler
new AotPlugin({
tsConfigPath: "tsconfig.aot.json",
entryModule: resolve(__dirname, "app/app.module#AppModule"),
typeChecking: false
}),
// Resolve .ios.css and .android.css component stylesheets
new nsWebpack.StyleUrlResolvePlugin({platform}),
];
if (env.uglify) {
plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true }));
// Work around an Android issue by setting compress = false
const compress = platform !== "android";
plugins.push(new webpack.optimize.UglifyJsPlugin({
"tsConfigPath": "src/tsconfig.app.json"
}));
plugins.push(new UglifyJsPlugin({
"mangle": {
"screw_ie8": true
},
"compress": {
"screw_ie8": true,
"warnings": false
},
"sourceMap": false
}));
} else {
plugins.push(new AotPlugin({
"mainPath": "main.ts",
"hostReplacementPaths": {
"environments/index.ts": "environments/index.ts"
},
"exclude": [],
"tsConfigPath": "src/tsconfig.app.json",
"skipCodeGeneration": true
}));
}
return plugins;
}
name: 'polyfills'
}),
new HtmlWebpackPlugin({
template: './src/index.html'
}),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify('production')
}
})
]
};
webpackProdConfig.plugins.push(new ngToolsWebpack.AotPlugin({
tsConfigPath: helpers.root('tsconfig.prod.json'),
entryModule: helpers.root('src' , 'app', 'app.module#AppModule'),
mainPath: helpers.root('src', 'browser.main.ts')
}));
module.exports = webpackProdConfig;
}
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader'
}])
},
resolve: {
extensions: ['.ts', '.js']
},
devServer: {
port: 8000,
inline: true
},
plugins: removeEmpty([
ifDevelopment(new ForkTsCheckerWebpackPlugin()),
ifProduction(new AotPlugin({
tsConfigPath: './tsconfig-aot.json'
})),
ifProduction(new webpack.optimize.UglifyJsPlugin({sourceMap: true})),
new webpack.DefinePlugin({
ENV: JSON.stringify(environment)
}),
extractCSS,
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)esm5/,
__dirname + '/src'
),
new webpack.optimize.CommonsChunkPlugin({
name: 'main',
async: true,
minChunks: 2
}),