@meteorjs/rspack 0.0.28 → 0.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/rspack.config.js
CHANGED
|
@@ -98,6 +98,16 @@ function createCoffeescriptConfig({ swcConfig }) {
|
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
// Keep files outside of build folders
|
|
102
|
+
function keepOutsideBuild() {
|
|
103
|
+
return (p) => {
|
|
104
|
+
const normalized = '/' + path.normalize(p).replaceAll(path.sep, '/').replace(/^\/+/, '');
|
|
105
|
+
const isInBuildRoot = /\/_build(\/|$)/.test(normalized);
|
|
106
|
+
const isInBuildStar = /\/_build-[^/]+(\/|$)/.test(normalized);
|
|
107
|
+
return !(isInBuildRoot || isInBuildStar); // true => KEEP, false => DELETE
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
101
111
|
// Watch options shared across both builds
|
|
102
112
|
const defaultWatchOptions = {
|
|
103
113
|
ignored: ['**/.meteor/local/**', '**/dist/**'],
|
|
@@ -282,7 +292,7 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
282
292
|
cssChunkFilename: `${assetsContext}/[id]${
|
|
283
293
|
isProd ? '.[contenthash]' : ''
|
|
284
294
|
}.css`,
|
|
285
|
-
clean:
|
|
295
|
+
...(isProd && { clean: { keep: keepOutsideBuild() } }),
|
|
286
296
|
},
|
|
287
297
|
optimization: {
|
|
288
298
|
usedExports: true,
|
|
@@ -371,7 +381,7 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
371
381
|
libraryTarget: 'commonjs',
|
|
372
382
|
chunkFilename: `${bundlesContext}/[id]${isProd ? '.[chunkhash]' : ''}.js`,
|
|
373
383
|
assetModuleFilename: `${assetsContext}/[hash][ext][query]`,
|
|
374
|
-
clean:
|
|
384
|
+
...(isProd && { clean: { keep: keepOutsideBuild() } }),
|
|
375
385
|
},
|
|
376
386
|
optimization: { usedExports: true },
|
|
377
387
|
module: {
|