@meteorjs/rspack 0.0.29 → 0.0.31
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 +1 -1
- package/rspack.config.js +14 -22
package/package.json
CHANGED
package/rspack.config.js
CHANGED
|
@@ -82,19 +82,14 @@ function createSwcConfig({
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
loader: 'coffee-loader',
|
|
96
|
-
},
|
|
97
|
-
],
|
|
85
|
+
|
|
86
|
+
// Keep files outside of build folders
|
|
87
|
+
function keepOutsideBuild() {
|
|
88
|
+
return (p) => {
|
|
89
|
+
const normalized = '/' + path.normalize(p).replaceAll(path.sep, '/').replace(/^\/+/, '');
|
|
90
|
+
const isInBuildRoot = /\/_build(\/|$)/.test(normalized);
|
|
91
|
+
const isInBuildStar = /\/_build-[^/]+(\/|$)/.test(normalized);
|
|
92
|
+
return !(isInBuildRoot || isInBuildStar); // true => KEEP, false => DELETE
|
|
98
93
|
};
|
|
99
94
|
}
|
|
100
95
|
|
|
@@ -138,7 +133,6 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
138
133
|
const isTsxEnabled =
|
|
139
134
|
Meteor.isTsxEnabled || (isTypescriptEnabled && isReactEnabled) || false;
|
|
140
135
|
|
|
141
|
-
const isCoffeescriptEnabled = Meteor.isCoffeescriptEnabled || false;
|
|
142
136
|
|
|
143
137
|
// Determine entry points
|
|
144
138
|
const entryPath = Meteor.entryPath;
|
|
@@ -217,6 +211,9 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
217
211
|
externalHelpers: swcExternalHelpers,
|
|
218
212
|
isDevEnvironment,
|
|
219
213
|
});
|
|
214
|
+
// Expose swc config to use in custom configs
|
|
215
|
+
Meteor.swcConfigOptions = swcConfigRule.options;
|
|
216
|
+
|
|
220
217
|
const externals = [
|
|
221
218
|
/^meteor.*/,
|
|
222
219
|
...(isReactEnabled ? [/^react$/, /^react-dom$/] : []),
|
|
@@ -225,7 +222,6 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
225
222
|
'/': path.resolve(process.cwd()),
|
|
226
223
|
};
|
|
227
224
|
const extensions = [
|
|
228
|
-
...(isCoffeescriptEnabled ? ['.coffee'] : []),
|
|
229
225
|
'.ts',
|
|
230
226
|
'.tsx',
|
|
231
227
|
'.mts',
|
|
@@ -237,11 +233,7 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
237
233
|
'.json',
|
|
238
234
|
'.wasm',
|
|
239
235
|
];
|
|
240
|
-
const extraRules = [
|
|
241
|
-
...(isCoffeescriptEnabled
|
|
242
|
-
? [createCoffeescriptConfig({ swcConfig: swcConfigRule?.options })]
|
|
243
|
-
: []),
|
|
244
|
-
];
|
|
236
|
+
const extraRules = [];
|
|
245
237
|
|
|
246
238
|
const reactRefreshModule = isReactEnabled
|
|
247
239
|
? safeRequire('@rspack/plugin-react-refresh')
|
|
@@ -282,7 +274,7 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
282
274
|
cssChunkFilename: `${assetsContext}/[id]${
|
|
283
275
|
isProd ? '.[contenthash]' : ''
|
|
284
276
|
}.css`,
|
|
285
|
-
clean:
|
|
277
|
+
...(isProd && { clean: { keep: keepOutsideBuild() } }),
|
|
286
278
|
},
|
|
287
279
|
optimization: {
|
|
288
280
|
usedExports: true,
|
|
@@ -371,7 +363,7 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
371
363
|
libraryTarget: 'commonjs',
|
|
372
364
|
chunkFilename: `${bundlesContext}/[id]${isProd ? '.[chunkhash]' : ''}.js`,
|
|
373
365
|
assetModuleFilename: `${assetsContext}/[hash][ext][query]`,
|
|
374
|
-
clean:
|
|
366
|
+
...(isProd && { clean: { keep: keepOutsideBuild() } }),
|
|
375
367
|
},
|
|
376
368
|
optimization: { usedExports: true },
|
|
377
369
|
module: {
|