Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
publicPath: settings.publicPath,
target: fullPath("../resources/"),
resourceBundleOptions: resourceBundleOptions
}),
new HtmlWebpackPlugin({
template: './res/index.ejs',
chunksSortMode: 'none',
vendorsScript: getDebugOrCdnPath(settings, path.relative(root, settings.vendorsFile)),
apiScript: apiScript,
coreScript: coreScript,
resourceBundleOptions: resourceBundleOptions
}),
new HtmlWebpackScriptCrossoriginPlugin({}),
new CheckerPlugin()
// new HtmlWebpackPlugin({
// template: './res/electron.ejs',
// chunksSortMode: 'none',
// vendorsScript: settings.authority + (settings.minimize ? settings.publicPath : "/") + settings.vendorsFile
// }),
];
if (settings.devServer) {
plugins.push(new webpack.HotModuleReplacementPlugin());
}
var defines = {
DEBUG: settings.debug,
'process.env.NODE_ENV': settings.minimize ? '"production"' : '"dev"'
};
'react-dom': {
commonjs: 'react-dom',
commonjs2: 'react',
amd: 'react-dom',
root: 'ReactDOM',
},
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false,
}),
new TsConfigPathsPlugin(),
new CheckerPlugin(),
new CaseSensitivePathsPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
// eslint-disable-next-line camelcase
screw_ie8: true,
warnings: false,
},
mangle: {
// eslint-disable-next-line camelcase
module.exports = (baseConfig, env, defaultConfig) => {
defaultConfig.module.rules.push({
test: /\.tsx?$/,
include: path.resolve(__dirname, '../src'),
loader: require.resolve('awesome-typescript-loader')
});
defaultConfig.plugins.push(new CheckerPlugin());
defaultConfig.resolve.extensions.push('.ts', '.tsx');
// defaultConfig.module.rules.push({
// test: /\.jsx?$/,
// include: [
// path.resolve(__dirname, "node_modules/semantic-ui-react"),
// path.resolve(__dirname, "node_modules/byte-size")
// ],
// loader: "babel-loader"
// });
return defaultConfig;
};
},
],
},
{ test: /\.html/, loader: 'raw-loader', exclude: [root('src/index.html')] },
{ test: /\.css$/, loader: 'raw-loader' },
{
test: /\.scss$/,
loaders: ['to-string-loader', 'css-loader', 'sass-loader'],
},
...MY_CLIENT_RULES,
],
};
config.plugins = [
new ProgressPlugin(),
new CheckerPlugin(),
new DefinePlugin(CONSTANTS),
new NamedModulesPlugin(),
new FilterWarningsPlugin({
exclude: /System\.import/,
}),
...MY_CLIENT_PLUGINS,
];
if (DEV_SERVER) {
config.plugins.push(
new DllReferencePlugin({
context: '.',
manifest: require(`./dll/polyfill-manifest.json`),
}),
new DllReferencePlugin({
context: '.',
{ loader: MiniCSSExtractPlugin.loader },
'css-loader',
'postcss-loader',
{
loader: 'sass-loader',
options: {
includePaths: [path.join(paths.src, 'scss'), paths.nodeModules],
},
},
],
},
],
},
plugins: [
new CheckerPlugin(),
new MiniCSSExtractPlugin({
filename: '[name].css',
}),
new DotenvPlugin({
path: root('.env'),
defaults: root('.env.defaults'),
safe: root('.env.example'),
}),
],
}
const development = { mode: 'development' }
const production = { mode: 'production' }
return {
development: mergeDeep(common, development),
production: mergeDeep(common, production),
}]
},
resolve: {
modules: [
path.join(__dirname, './src'),
path.join(__dirname, './node_modules'),
],
extensions: ['.ts', '.tsx', '.js', '.jsx', '.scss']
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new CheckerPlugin(),
CopyWebpackPlugin([{
from: './src/static',
to: './'
}])
],
externals: {
'webdnn': 'WebDNN'
}
};
}
const fs = require('fs')
const path = require('path')
const webpack = require('webpack')
const MinifyPlugin = require('babel-minify-webpack-plugin')
const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin
const license = fs.readFileSync('LICENSE', 'utf8')
const isProduction = process.env.NODE_ENV === 'production'
const plugins = []
if (isProduction) {
plugins.push(new MinifyPlugin())
}
plugins.push(
new CheckerPlugin(),
new webpack.BannerPlugin({
banner: license
}),
new webpack.DefinePlugin({
VERSION: JSON.stringify(require('./package.json').version)
})
)
module.exports = {
mode: isProduction ? 'production' : 'development',
entry: './src/index.ts',
output: {
filename: isProduction ? 'hlviewer.min.js' : 'hlviewer.js',
path: path.resolve(__dirname, './dist'),
library: 'HLViewer',
libraryTarget: 'umd'
resolve: {
extensions: ['.ts', '.js', '.scss', '.css']
},
node: {
global: true,
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
}
if (debug) {
config.plugins.push(
new CheckerPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin()
)
config.devServer = {
contentBase: path.join(__dirname, "src"),
port: 3000,
host: 'localhost',
historyApiFallback: true,
inline: true,
hot: true,
watchOptions: {
aggregateTimeout: 300,
poll: 1000
}
}
options: Object.assign(
{
transpileOnly: true,
useBabel: true,
useCache: true,
forceIsolatedModules: true,
cacheDirectory: "node_modules/.cache/awesome-typescript-loader",
babelOptions: fixBabelConfig,
},
loaderOptions
),
},
],
});
if (useCheckerPlugin) config.plugins.push(new CheckerPlugin());
if (typeof nextConfig.webpack === "function") {
return nextConfig.webpack(config, options);
}
return config;
},
});