add treeshaking tests

This commit is contained in:
Rene Haas
2022-08-10 02:09:20 +02:00
parent 35d4d908f4
commit 641449ac82
44 changed files with 1187 additions and 243 deletions
+16 -8
View File
@@ -107,22 +107,30 @@ const createConfig = (userOptions = {}) => {
const options = mergeAndResolveOptions(userOptions);
const { project, mode, extractTypes, extractStyles, verbose } = options;
const isBuild = mode === 'build';
if (verbose) {
console.log('');
console.log('PROJECT : ', project);
console.log('OPTIONS : ', options);
}
let result;
if (isBuild) {
const styles = extractStyles && pipelineStyles(resolve, options);
const types = extractTypes && pipelineTypes(resolve, options);
const js = pipelineBuild(resolve, options);
return [styles, types, js].flat().filter((build) => !!build);
result = [styles, types, js].flat().filter((build) => !!build);
} else {
result = [pipelineDev(resolve, options)];
}
return [pipelineDev(resolve, options)];
if (verbose) {
result[0].plugins.push({
name: 'PROJECT',
buildStart() {
console.log('');
console.log('PROJECT : ', project);
console.log('OPTIONS : ', options);
},
});
}
return result;
};
module.exports = createConfig;
-4
View File
@@ -61,10 +61,6 @@ module.exports = (resolve, options) => {
return {
input,
output,
treeshake: {
propertyReadSideEffects: false,
moduleSideEffects: false,
},
...rollupOptions,
plugins: [
rollupLicense(banner, sourcemap),
+1 -1
View File
@@ -87,7 +87,7 @@ module.exports = {
['@babel/plugin-proposal-private-methods', { loose: true }],
],
babelHelpers: 'runtime',
shouldPrintComment: () => false,
shouldPrintComment: (comment) => /@__PURE__/.test(comment),
caller: {
name: 'babel-rollup-build',
},
@@ -75,7 +75,6 @@ module.exports = (testDir, mode = 'dev', onListening = null) => {
output: {
sourcemap: true,
},
treeshake: true,
plugins: [
rollupPluginStyles(),
rollupPluginHtml(`Playwright: ${name}`, htmlName, () =>