Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
})
],
]
},
// CommonJS (for Node) build.
{
input: 'index.js',
external: externals,
output: [
{ file: packageJSON.main, format: 'cjs' }
],
plugins: [
...sharedPlugins,
...[
isProduction && compiler(closureOptions),
isProduction && uglify({
compress: {
// screw_ie8: true,
warnings: false
},
output: {
comments: false
},
sourceMap: false
})
],
],
},
// ES module (for bundlers) build.
{
input: 'index.js',
}),
typescript(typescriptPluginOptions),
resolve({
preferBuiltins: true
}),
commonjs(),
globals(),
builtins(),
json(),
// Copy over some assets for running the wasm terminal
copy({
targets: [
{ src: "./node_modules/xterm/dist/xterm.css", dest: "dist/xterm/" }
]
}),
process.env.PROD ? compiler() : undefined,
process.env.PROD ? bundleSize() : undefined
];
const unoptimizedPlugins = [
replace(replaceInlineOptions),
inlineUrlPlugin,
...plugins
];
const unoptimizedBundles = [
{
input: "./lib/index.ts",
output: {
file: "dist/unoptimized/wasm-terminal.esm.js",
format: "esm",
sourcemap: sourcemapOption
plugins: [
// indexify({
// input: "./src/index.html",
// output: "./public/index.html"
// }),
json(),
svelte({
dev: !production,
extensions: [".html", ".svelte", ".svg"],
css: css => {
css.write('public/_generated/main.css');
}
}),
resolve(),
commonjs(),
production && compiler()
]
},
{
input: "src/app.js",
output: {
file: production ? 'public/_generated/app.min.js' : 'public/_generated/app.js',
format: 'iife',
sourcemap: true,
},
context: "window",
plugins: [
json(),
svelte({
dev: !production,
extensions: [".html", ".svelte", ".svg"],
css: css => {
BUILD_NODE: JSON.stringify(false),
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
'process.env.VERSION': JSON.stringify(packageJSON.version)
}),
commonjs({
include: 'node_modules/**',
// ignore: [ 'conditional-runtime-dependency' ]
}),
nodeResolve({
jsnext: true,
browser: true,
builtins: false,
main: true,
}),
...[
isProduction && compiler({
compilationLevel: 'SIMPLE',
languageIn: 'ECMASCRIPT5_STRICT',
languageOut: 'ECMASCRIPT5',
env: 'CUSTOM',
warningLevel: 'QUIET',
applyInputSourceMaps: false,
useTypesForOptimization: false,
processCommonJsModules: false,
}),
isProduction && uglify({
compress: {
// screw_ie8: true,
warnings: false
},
output: {
comments: false
inputs.map(input => ({
input,
plugins: [
replace({
__DEV__: minify ? 'false' : 'true',
}),
babel(),
// The two minifiers together seem to procude a smaller bundle 🤷♂️
minify && compiler(),
minify && terser(),
license({ banner: `@popperjs/core v${pkg.version}` }),
flow && flowEntry(),
bundleSize(),
visualizer({
sourcemap: true,
filename: `stats/${getFileName(input)}${minify ? '-min' : ''}.html`,
}),
].filter(Boolean),
output: {
name: 'Popper',
file: `${dir}/${format}/${getFileName(input)}${
minify ? '.min' : ''
}.js`,
format,
sourcemap: true,
},
// Remove node builtins for browser. Might not need
...[
config.browser && removeNodeBuiltIns(),
],
replace({
'process.browser': JSON.stringify(!!config.browser),
'process.env.NODE_ENV': isProduction ? "'production'" : "'development'",
'process.env.VERSION': JSON.stringify(pkg.version)
}),
commonjs({
include: 'node_modules/**',
// ignore: [ 'conditional-runtime-dependency' ]
}),
...[
doMinify && isProduction && !isESModule && compiler({
compilationLevel: 'SIMPLE',
languageIn: 'ECMASCRIPT5_STRICT',
languageOut: (isIIFE) ? 'ECMASCRIPT5' : 'ECMASCRIPT5_STRICT',
env: (isIIFE) ? 'BROWSER' : 'CUSTOM',
warningLevel: 'QUIET',
applyInputSourceMaps: false,
useTypesForOptimization: false,
processCommonJsModules: false,
}),
// Try all the shrinkers
doMinify && isProduction && !isESModule && !isIIFE && terser(),
doMinify && isProduction && !isESModule && !isIIFE && minify(),
doMinify && isProduction && !isESModule && !isIIFE && uglify({
compress: {
// screw_ie8: true,
warnings: false
let typescriptPluginOptions = {
tsconfig: "../../tsconfig.json",
exclude: ["./test/**/*"],
clean: process.env.PROD ? true : false
};
let plugins = [
typescript(typescriptPluginOptions),
resolve({
preferBuiltins: true
}),
commonjs(),
globals(),
builtins(),
json(),
process.env.PROD ? compiler() : undefined,
process.env.PROD ? bundleSize() : undefined
];
const fileSystemBundles = [
{
input: "src/index.ts",
output: [
{
file: pkg.main,
format: "cjs",
sourcemap: sourcemapOption
},
{
file: pkg.module,
format: "esm",
sourcemap: sourcemapOption
entries: [
{
find: "comlink",
replacement: `${__dirname}/node_modules/comlink/src/comlink`
}
]
}),
typescript(typescriptPluginOptions),
resolve({
preferBuiltins: true
}),
commonjs(),
globals(),
builtins(),
json(),
process.env.PROD ? compiler() : undefined,
process.env.PROD ? bundleSize() : undefined
];
const workerBundles = [
{
input: "./src/workers/process.worker.ts",
output: [
{
file: "lib/workers/process.worker.js",
format: "iife",
sourcemap: sourcemapOption,
name: "Process"
}
],
watch: {
clearScreen: false
let typescriptPluginOptions = {
tsconfig: "../../tsconfig.json",
exclude: ["./test/**/*"],
clean: process.env.PROD ? true : false
};
let plugins = [
typescript(typescriptPluginOptions),
resolve({
preferBuiltins: true
}),
commonjs(),
globals(),
builtins(),
json(),
process.env.PROD ? compiler() : undefined,
process.env.PROD ? bundleSize() : undefined
];
const fileSystemBundles = [
{
input: "src/index.ts",
output: [
{
file: pkg.main,
format: "cjs",
sourcemap: sourcemapOption
},
{
file: pkg.module,
format: "esm",
sourcemap: sourcemapOption
let typescriptPluginOptions = {
tsconfig: "../../tsconfig.json",
exclude: ["./test/**/*"],
clean: process.env.PROD ? true : false,
objectHashIgnoreUnknownHack: true
};
const plugins = [
typescript(typescriptPluginOptions),
resolve({ preferBuiltins: true }),
commonjs(),
globals(),
builtins(),
json(),
process.env.PROD ? compiler() : undefined,
process.env.PROD ? bundleSize() : undefined
];
const libBundles = [
{
input: "./src/index.ts",
output: {
file: pkg.module,
format: "esm",
sourcemap: sourcemapOption
},
watch: {
clearScreen: false
},
plugins: [replace(replaceBrowserOptions), ...plugins]
},