Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
devtool: 'source-map',
resolve: {
extensions: ['.ts', '.tsx', '.js', '.scss', '.css'],
modules: [absolute('src'), absolute('node_modules')],
},
plugins: [
// Provide NODE_ENV variable
new webpack.DefinePlugin({
'NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development')
}),
// Fork type-check to separate process
new ForkTsCheckerPlugin({
workers: ForkTsCheckerPlugin.TWO_CPUS_FREE,
watch: ['src']
}),
new HtmlPlugin({
template: 'example/index.html',
hash: false,
filename: 'index.html',
inject: 'body',
}),
new webpack.NoEmitOnErrorsPlugin()
],
module: {
rules: [
{
test: /\.tsx?$/,
use: [
}
],
},
resolve: {
modules: [SRC_DIR, 'node_modules'],
extensions: ['.ts', '.js'],
},
plugins: [
new BannerPlugin({
banner: '#!/usr/bin/env node',
}),
new ForkTsCheckerWebpackPlugin({
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
watch: SRC_DIR,
// CI memory limits make building with more than one CPU for type-checking too fragile, unfortunately
workers: isCI ? ForkTsCheckerWebpackPlugin.ONE_CPU : ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
memoryLimit: 4096,
}),
],
devtool: 'source-map',
optimization: {
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
// Chevrotain does not cooperate with webpack mangling (see here: https://sap.github.io/chevrotain/docs/FAQ.html#MINIFIED).
mangle: {
reserved,
},
},
}),
],
},
resolve: {
modules: [SRC_DIR, 'node_modules'],
extensions: ['.ts', '.js'],
},
plugins: [
new BannerPlugin({
banner: '#!/usr/bin/env node',
}),
new ForkTsCheckerWebpackPlugin({
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
watch: SRC_DIR,
// CI memory limits make building with more than one CPU for type-checking too fragile, unfortunately
workers: isCI
? ForkTsCheckerWebpackPlugin.ONE_CPU
: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
memoryLimit: 4096,
}),
],
devtool: 'source-map',
optimization: {
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
// Chevrotain does not cooperate with webpack mangling (see here: https://sap.github.io/chevrotain/docs/FAQ.html#MINIFIED).
mangle: {
reserved,
},
},
}),
],
exclude: [/node_modules/],
},
],
},
resolve: {
modules: [SRC_DIR, 'node_modules'],
extensions: ['.ts', '.js'],
},
plugins: [
new ForkTsCheckerWebpackPlugin({
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
watch: SRC_DIR,
// CI memory limits make building with more than one CPU for type-checking too fragile, unfortunately
workers: isCI
? ForkTsCheckerWebpackPlugin.ONE_CPU
: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
memoryLimit: 4096,
}),
new CopyWebpackPlugin([
{
from: `${SRC_DIR}/index.d.ts`,
to: path.join(DIST_DIR, 'types', 'index.d.ts'),
},
]),
],
devtool: 'source-map',
};
const workerConfig = {
mode: 'production',
target: 'webworker',
entry: path.join(SRC_DIR, 'worker.ts'),
},
resolve: {
modules: [SRC_DIR, 'node_modules'],
extensions: ['.ts', '.js'],
},
plugins: [
new BannerPlugin({
banner: '#!/usr/bin/env node',
}),
new ForkTsCheckerWebpackPlugin({
tsconfig: path.resolve(__dirname, 'tsconfig.json'),
watch: SRC_DIR,
// CI memory limits make building with more than one CPU for type-checking too fragile, unfortunately
workers: isCI
? ForkTsCheckerWebpackPlugin.ONE_CPU
: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
memoryLimit: 4096,
}),
],
devtool: 'source-map',
optimization: {
minimizer: [
new TerserPlugin({
sourceMap: true,
terserOptions: {
// Chevrotain does not cooperate with webpack mangling (see here: https://sap.github.io/chevrotain/docs/FAQ.html#MINIFIED).
mangle: {
reserved,
},
},
}),
],
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=application/octet-stream" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file-loader" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url-loader?limit=10000&mimetype=image/svg+xml" },
{ test: /\.html$/, use: 'html-loader' }
];
var plugins = [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.ProvidePlugin({
"$":"jquery",
"jQuery":"jquery",
"window.jQuery":"jquery"
}),
new ForkTsCheckerWebpackPlugin({
watch: 'src',
workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE
}),
new webpack.DefinePlugin({
BEAKERX_MODULE_VERSION: JSON.stringify("*") // The latest version
})
];
var externals = [
'@jupyter-widgets/base',
'@jupyter-widgets/controls'
];
var resolve = {
modules: ['web_modules', 'node_modules'],
extensions: ['.ts', '.jsx','.js','.less','.css']
};
test: /\.mp4$/,
loader: "file-loader",
},
],
},
plugins: [
new StylelintPlugin({
configFile: env.stylelintConfig,
context: env.entry,
files: "**/*.less",
syntax: "less",
}),
new ForkTSCheckerPlugin({
tsconfig: env.tsConfig,
tslint: env.tslintConfig,
workers: ForkTSCheckerPlugin.TWO_CPUS_FREE,
}),
new HTMLPlugin({
template: path.resolve(__dirname, `${env.entry}/index.html`) /* 自动在该模板中导入 output 中的filename文件 */,
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.ProgressPlugin() /* 控制台显示加载进度 */,
],
});
filename: "css/[name].[contenthash:8].css",
}),
/* new ManifestPlugin({
fileName: "asset-manifest.json",
publicPath: conEnv.clientPublicPath,
}), */
new StylelintPlugin({
configFile: path.join(paths.rootPath, "./.stylelintrc.json"),
context: paths.srcPath,
files: "**/*.less",
syntax: "less",
}),
new ForkTsCheckerWebpackPlugin({
tsconfig: path.join(paths.rootPath, "./tsconfig.json"),
tslint: path.join(paths.rootPath, "./tslint.json"),
workers: ForkTsCheckerWebpackPlugin.TWO_CPUS_FREE,
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new webpack.ProgressPlugin(),
],
};
module.exports = config;
test: /\.mp4$/,
loader: "file-loader",
options: {
name: `static/mp4/[name].[hash:8].[ext]`,
},
},
],
},
plugins: [
new MiniCSSExtractPlugin({
filename: `static/css/[name].[contenthash:8].css`,
}),
new ForkTSCheckerPlugin({
tsconfig: env.tsConfig,
tslint: env.tslintConfig,
workers: ForkTSCheckerPlugin.TWO_CPUS_FREE,
}),
new StylelintPlugin({
configFile: env.stylelintConfig,
context: env.src,
files: "**/*.less",
syntax: "less",
}),
new HTMLPlugin({
template: `${env.src}/index.html`,
minify: {
collapseBooleanAttributes: true,
collapseInlineTagWhitespace: true,
collapseWhitespace: true,
includeAutoGeneratedTags: false,
keepClosingSlash: true,
minifyCSS: true,
'sass-loader'
])
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx'],
modules: [absolute('src'), absolute('node_modules')]
},
externals: {
'react': 'React',
'react-dom': 'react-dom'
},
plugins: [
new ForkTsCheckerPlugin({
workers: ForkTsCheckerPlugin.TWO_CPUS_FREE,
watch: ['src']
}),
new ExtractTextPlugin('react-inline-suggest.css')
]
};
module.exports = config;