Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
htmlMinifier: {
collapseWhitespace: true,
removeComments: true,
caseSensitive: true,
minifyCSS: customMinifyCss,
},
},
],
].filter(_ => !!_),
presets: [
[
'@babel/preset-env',
{
targets: findSupportedBrowsers(),
// preset-env compiles template literals for safari 12 due to a small bug which
// doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
exclude: ['@babel/plugin-transform-template-literals'],
useBuiltIns: false,
modules: false,
},
],
],
}),
// only minify if in production
production && terser()
];
const outputOptions = [
{
conservativeCollapse: true,
removeComments: true,
caseSensitive: true,
minifyCSS: customMinifyCSS,
},
},
],
// webpack does not support import.meta.url yet, so we rewrite them in babel
[require.resolve('babel-plugin-bundled-import-meta'), { importStyle: 'baseURI' }],
].filter(_ => !!_),
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: findSupportedBrowsers(),
// preset-env compiles template literals for safari 12 due to a small bug which
// doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
exclude: ['@babel/plugin-transform-template-literals'],
useBuiltIns: false,
modules: false,
},
],
],
},
},
},
].filter(_ => !!_),
},
optimization: {
minimizer: [
htmlMinifier: {
collapseWhitespace: true,
conservativeCollapse: true,
removeComments: true,
caseSensitive: true,
minifyCSS: customMinifyCss,
},
},
],
].filter(_ => !!_),
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: legacy ? ['ie 11'] : findSupportedBrowsers(),
// preset-env compiles template literals for safari 12 due to a small bug which
// doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
exclude: legacy ? undefined : ['@babel/plugin-transform-template-literals'],
useBuiltIns: false,
modules: false,
},
],
],
}),
// only minify if in production
production && terser(),
production &&
options.plugins.workbox &&
!legacy &&
conservativeCollapse: true,
removeComments: true,
caseSensitive: true,
minifyCSS: customMinifyCSS,
},
},
],
// webpack does not support import.meta.url yet, so we rewrite them in babel
[require.resolve('babel-plugin-bundled-import-meta'), { importStyle: 'baseURI' }],
].filter(_ => !!_),
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: legacy ? ['ie 11'] : findSupportedBrowsers(),
// preset-env compiles template literals for safari 12 due to a small bug which
// doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
exclude: legacy ? undefined : ['@babel/plugin-transform-template-literals'],
useBuiltIns: false,
modules: false,
},
],
],
},
},
},
].filter(_ => !!_),
},
optimization: {
minimizer: [
require.resolve('@babel/plugin-syntax-dynamic-import'),
require.resolve('@babel/plugin-syntax-import-meta'),
],
sourceType: 'module',
// only read the user's babelrc and config if explicitly enabled
babelrc: readUserBabelConfig,
configFile: readUserBabelConfig,
};
}
const modernConfig = {
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: findSupportedBrowsers(),
useBuiltIns: false,
modules: false,
},
],
],
};
const legacyConfig = {
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: ['ie 11'],
useBuiltIns: false,
modules: 'systemjs',
},
require.resolve('@babel/plugin-syntax-dynamic-import'),
require.resolve('@babel/plugin-syntax-import-meta'),
],
sourceType: 'module',
// only read the user's babelrc if explicitly enabled
babelrc,
sourceMap: 'inline',
};
}
const modernConfig = {
presets: [
[
'@babel/preset-env',
{
targets: findSupportedBrowsers(),
useBuiltIns: false,
modules: false,
},
],
],
};
const legacyConfig = {
presets: [
[
'@babel/preset-env',
{
targets: ['ie 11'],
useBuiltIns: false,
modules: 'systemjs',
},
htmlMinifier: {
collapseWhitespace: true,
conservativeCollapse: true,
removeComments: true,
caseSensitive: true,
minifyCSS: customMinifyCss,
},
},
],
].filter(_ => !!_),
presets: [
[
require.resolve('@babel/preset-env'),
{
targets: findSupportedBrowsers(),
// preset-env compiles template literals for safari 12 due to a small bug which
// doesn't affect most use cases. for example lit-html handles it: (https://github.com/Polymer/lit-html/issues/575)
exclude: ['@babel/plugin-transform-template-literals'],
useBuiltIns: false,
modules: false,
},
],
],
}),
// only minify if in production
production && terser(),
production && options.plugins.workbox && generateSW(getWorkboxConfig(options.outputDir)),
],
};