@meteorjs/rspack 0.0.0 → 0.0.1
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/index.d.ts +36 -0
- package/index.js +23 -0
- package/package.json +1 -1
- package/rspack.config.js +3 -8
package/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extend Rspack’s Configuration with Meteor-specific options.
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
defineConfig as _rspackDefineConfig,
|
|
6
|
+
Configuration as _RspackConfig,
|
|
7
|
+
} from '@rspack/cli';
|
|
8
|
+
|
|
9
|
+
export interface MeteorRspackConfig extends _RspackConfig {
|
|
10
|
+
meteor?: {
|
|
11
|
+
packageNamespace?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type MeteorEnv = Record<string, any> & {
|
|
16
|
+
isDevelopment: boolean;
|
|
17
|
+
isProduction: boolean;
|
|
18
|
+
isClient: boolean;
|
|
19
|
+
isServer: boolean;
|
|
20
|
+
isTest: boolean;
|
|
21
|
+
isDebug: boolean;
|
|
22
|
+
isRun: boolean;
|
|
23
|
+
isBuild: boolean;
|
|
24
|
+
isReactEnabled: boolean;
|
|
25
|
+
isBlazeEnabled: boolean;
|
|
26
|
+
isBlazeHotEnabled: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type ConfigFactory = (
|
|
30
|
+
env: MeteorEnv,
|
|
31
|
+
argv: Record<string, any>
|
|
32
|
+
) => MeteorRspackConfig;
|
|
33
|
+
|
|
34
|
+
export function defineConfig(
|
|
35
|
+
factory: ConfigFactory
|
|
36
|
+
): ReturnType<typeof _rspackDefineConfig>;
|
package/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineConfig as rspackDefineConfig } from '@rspack/cli';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import('rspack').Configuration & {
|
|
5
|
+
* meteor?: { packageNamespace?: string }
|
|
6
|
+
* }} MeteorRspackConfig
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {(env: Record<string, any>, argv: Record<string, any>) => MeteorRspackConfig} ConfigFactory
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Wrap rspack.defineConfig but only accept a factory function.
|
|
15
|
+
* @param {ConfigFactory} factory
|
|
16
|
+
* @returns {ReturnType<typeof rspackDefineConfig>}
|
|
17
|
+
*/
|
|
18
|
+
export function defineConfig(factory) {
|
|
19
|
+
return rspackDefineConfig(factory);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Export our helper plus passthrough
|
|
23
|
+
export default defineConfig;
|
package/package.json
CHANGED
package/rspack.config.js
CHANGED
|
@@ -65,7 +65,7 @@ function createSwcConfig({ isRun }) {
|
|
|
65
65
|
|
|
66
66
|
// Watch options shared across both builds
|
|
67
67
|
const watchOptions = {
|
|
68
|
-
ignored: ['
|
|
68
|
+
ignored: ['**/.meteor/local/**', '**/dist/**'],
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
/**
|
|
@@ -202,7 +202,6 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
202
202
|
writeToDisk: false,
|
|
203
203
|
},
|
|
204
204
|
},
|
|
205
|
-
experiments: { incremental: true },
|
|
206
205
|
}),
|
|
207
206
|
};
|
|
208
207
|
|
|
@@ -222,11 +221,6 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
222
221
|
optimization: { usedExports: true },
|
|
223
222
|
module: {
|
|
224
223
|
rules: [
|
|
225
|
-
{
|
|
226
|
-
test: /\.meteor\/local/,
|
|
227
|
-
use: 'builtin:empty-loader',
|
|
228
|
-
sideEffects: false,
|
|
229
|
-
},
|
|
230
224
|
createSwcConfig({ isRun }),
|
|
231
225
|
],
|
|
232
226
|
},
|
|
@@ -252,7 +246,8 @@ export default function (inMeteor = {}, argv = {}) {
|
|
|
252
246
|
watchOptions,
|
|
253
247
|
devtool: isRun ? 'source-map' : 'hidden-source-map',
|
|
254
248
|
...(isRun &&
|
|
255
|
-
|
|
249
|
+
createCacheStrategy(mode)
|
|
250
|
+
),
|
|
256
251
|
};
|
|
257
252
|
|
|
258
253
|
// Load and apply project-level overrides for the selected build
|