Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
limit: 10000
}
}
}
]
},
plugins: options.plugins.concat([
// Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
// inside your code for any environment checks; UglifyJS will automatically
// drop any unreachable code.
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
}),
new webpack.ContextReplacementPlugin(/^\.\/locale$/, (context) => {
if (!/\/moment\//.test(context.context)) return;
Object.assign(context, {
regExp: /^\.\/\w+/,
request: '../../locale', // resolved relatively
});
}),
new webpack.ProvidePlugin({
'window.Quill': 'quill'
}),
new HappyPack({
id: 'typescript',
loaders: options.tsLoaders,
threadPool: happyThreadPool,
verbose: true
}),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(env),
},
}),
new webpack.DefinePlugin({
"process.env": {
apiUrl: "process.env.apiUrl",
uploadUrl: "process.env.uploadUrl",
rootUrl: "process.env.rootUrl",
appPort: "process.env.appPort",
baseName: "process.env.baseName",
},
}),
new FileNameReplacementPlugin(args.theme),
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
],
module: {
rules: [
{
test: /\.js$/,
use: [
{
loader: "babel-loader",
options: {
cacheDirectory: true,
...JSON.parse(babelRc),
},
},
// { loader: "eslint-loader" },
],
{
test: /\.css$/,
exclude: helpers.root('src', 'app'),
loader: ExtractTextPlugin.extract({ fallbackLoader: 'style-loader', loader: 'css-loader' })
},
{
test: /\.css$/,
include: helpers.root('src', 'app'),
loader: 'raw-loader'
}
]
},
plugins: [
// see https://github.com/angular/angular/issues/11580
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
path.resolve(__dirname, '../src')
),
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor', 'polyfills']
}),
new HtmlWebpackPlugin({
template: 'src/index.html'
}),
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify('dev')
}
to: 'manifest.json',
transform: (content) => {
const jsonContent = JSON.parse(content);
jsonContent.version = version;
if (!isProduction) {
jsonContent.content_security_policy = "script-src 'self' 'unsafe-eval'; object-src 'self'";
}
return JSON.stringify(jsonContent, null, 2);
},
}]));
// Exclude cards from build
if (excludeCards.length) {
const nonExcluded = Object.keys(cards)
.filter(f => excludeCards.indexOf(f) === -1);
if (nonExcluded.length > 0) {
config.plugins.push(new ContextReplacementPlugin(
/cards$/,
new RegExp(`${nonExcluded.join('|')}`),
));
}
}
// Define variable in the extension
config.plugins.push(new DefinePlugin({
browserName: JSON.stringify(browserName),
}));
// Pre-render
if (isProduction && (!process.env.TRAVIS || !process.env.CI)) {
config.plugins.push(new PrerenderSPAPlugin({
staticDir: path.join(__dirname, 'dist'),
routes: ['/'],
postProcess(route) {
// eslint-disable-next-line
output: {
path: path.join(__dirname, "./public/dist"),
filename: "[name].js"
},
module: {
rules: [{ test: /\.ts$/, loader: "ts-loader" }]
},
plugins: [
// Temporary Fix for issue: https://github.com/angular/angular/issues/11580
// for 'WARNING Critical dependency: the request of a dependency is an expression'
new webpack.ContextReplacementPlugin(
/(.+)?angular(\\|\/)core(.+)?/,
path.join(__dirname, "src"), // location of your src
{} // a map of your routes
),
new webpack.ContextReplacementPlugin(
/(.+)?express(\\|\/)(.+)?/,
path.join(__dirname, "src"),
{}
)
]
};
use: {
loader: resolve(__dirname, '../../../node_modules', 'url-loader'),
options: {
limit: 10000,
name: posix.join('static', 'fonts/[name].[hash:7].[ext]')
}
}
}
]
},
plugins: [
new VueLoaderPlugin(),
// new MonacoWebpackPlugin(),
// moment 优化,只提取本地包
new webpack.ContextReplacementPlugin(/moment\/locale$/, /zh-cn/),
new CopyWebpackPlugin([
{
from: resolve(__dirname, '..', 'static', 'images'),
to: resolve(__dirname, '..', 'dist/static/images'),
toType: 'dir'
}
])
]
}
{from: `${nodeModules}/no-vnc`, to: 'vendor/no-vnc'},
{from: `${nodeModules}/spice-html5-bower`, to: 'vendor/spice-html5-bower'},
// Override images with skin replacements if they exist
{from: hasSkinImages ? `${root}/skin/images` : '', to: 'images', force: true},
]),
// Generate index.html from template with script/link tags for bundles
new HtmlWebpackPlugin({
base: '/',
template: '../client/index.ejs',
}),
// Fix circular dependency error:
// https://github.com/angular/angular/issues/11580#issuecomment-282705332
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)@angular/,
root
)
],
resolve: {
extensions: ['.ts', '.js'],
symlinks: false,
},
// Disables noisy performance warnings. While the warnings are important, it
// is not feasible to satisfy the recommendations until we start code splitting
performance: {
hints: false,
},
};
module.exports = function(config) {
let webpackConfig = webpack_helpers.getBaseConfig({useBabel: false, noOutput: true});
webpackConfig.mode = 'development';
const argv = minimist(process.argv);
let pattern = argv['pattern'] || '';
let patternSuffix = '\\.benchmark\\.ts$';
let newRegExp = new RegExp(pattern + patternSuffix);
webpackConfig.plugins = [
new webpack.ContextReplacementPlugin(
/.*/,
result => {
if (result.regExp.source === patternSuffix) {
result.regExp = newRegExp;
}
}),
];
config.set({
files: [
'../src/benchmark.js',
],
frameworks: ['benchmark'],
preprocessors: {
'../src/benchmark.js': ['webpack'],
},
* https://webpack.github.io/docs/list-of-plugins.html
*/
plugins: [
new webpack.NamedModulesPlugin(),
/*
* https://webpack.github.io/docs/list-of-plugins.html#commonschunkplugin
*/
new webpack.optimize.CommonsChunkPlugin({
name: ['main', 'vendor', 'polyfills'],
}),
/*
* https://github.com/angular/angular/issues/11580
*/
new webpack.ContextReplacementPlugin(
/angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
helpers.root('src'),
{}
),
/*
* https://www.npmjs.com/package/copy-webpack-plugin
*/
new CopyWebpackPlugin([
{from: 'src/static'},
]),
/*
* https://github.com/ampedandwired/html-webpack-plugin
*/
new HtmlWebpackPlugin({
new webpack.ContextReplacementPlugin(
/^components\/common-ui/,
context => {
context.request = path.resolve(
'./src/app/components/common-ui',
);
},
),
);
plugins.push(
new webpack.ContextReplacementPlugin(/^components/, context => {
context.request = path.resolve('./src/app/components');
}),
);
plugins.push(
new webpack.ContextReplacementPlugin(
/^reactium-core\/components/,
context => {
context.request = path.resolve('./.core/components');
},
),
);
plugins.push(
new webpack.ContextReplacementPlugin(
/reactium-translations$/,
context => {
context.request = path.resolve('./src/reactium-translations');
},
),
);
plugins.push(
new FilterWarningsPlugin({