mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'modern-bundler-integration' into release-3.4
This commit is contained in:
4
npm-packages/meteor-rspack/package-lock.json
generated
4
npm-packages/meteor-rspack/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.60",
|
||||
"version": "0.0.61",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.60",
|
||||
"version": "0.0.61",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@meteorjs/rspack",
|
||||
"version": "0.0.60",
|
||||
"version": "0.0.61",
|
||||
"description": "Configuration logic for using Rspack in Meteor projects",
|
||||
"main": "index.js",
|
||||
"type": "commonjs",
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
export const DEFAULT_RSPACK_VERSION = '1.6.0';
|
||||
|
||||
export const DEFAULT_METEOR_RSPACK_VERSION = '0.0.60';
|
||||
export const DEFAULT_METEOR_RSPACK_VERSION = '0.0.61';
|
||||
|
||||
export const DEFAULT_METEOR_RSPACK_REACT_HMR_VERSION = '1.4.3';
|
||||
|
||||
|
||||
@@ -118,6 +118,12 @@ export function getCustomConfigFilePath(basePath = getMeteorAppDir()) {
|
||||
return jsPath;
|
||||
}
|
||||
|
||||
// Check for .ts extension next
|
||||
const tsPath = `${configBasePath}.ts`;
|
||||
if (fs.existsSync(tsPath)) {
|
||||
return tsPath;
|
||||
}
|
||||
|
||||
// Check for .mjs extension next
|
||||
const mjsPath = `${configBasePath}.mjs`;
|
||||
if (fs.existsSync(mjsPath)) {
|
||||
@@ -158,7 +164,7 @@ export function getConfigFilePath() {
|
||||
}
|
||||
|
||||
// If no config file is found, throw an error
|
||||
throw new Error('Could not find rspack.config.js, rspack.config.mjs, or rspack.config.cjs. Make sure @meteorjs/rspack is installed correctly.');
|
||||
throw new Error('Could not find rspack.config.js, rspack.config.ts, rspack.config.mjs, or rspack.config.cjs. Make sure @meteorjs/rspack is installed correctly.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
const { defineConfig } = require('@meteorjs/rspack');
|
||||
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
||||
import { defineConfig } from "@meteorjs/rspack";
|
||||
import { TsCheckerRspackPlugin } from "ts-checker-rspack-plugin";
|
||||
import { createRequire } from 'node:module';
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
/**
|
||||
* Rspack configuration for Meteor projects.
|
||||
@@ -11,7 +14,7 @@ const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
||||
*
|
||||
* Use these flags to adjust your build settings based on environment.
|
||||
*/
|
||||
module.exports = defineConfig(Meteor => {
|
||||
export default defineConfig((/* Meteor */) => {
|
||||
return {
|
||||
module: {
|
||||
rules: [
|
||||
@@ -17,7 +17,7 @@
|
||||
"vue-router": "^4.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rspack/cli": "^1.4.8",
|
||||
"@rspack/core": "^1.4.8",
|
||||
"@tailwindcss/postcss": "^4.1.12",
|
||||
|
||||
@@ -13,6 +13,7 @@ describe('Monorepo App Bundling /', () => {
|
||||
server: 'app/server/main.js',
|
||||
test: 'app/tests/main.test.js'
|
||||
},
|
||||
configFile: 'rspack.config.cjs',
|
||||
customAssertions: {
|
||||
afterRunRebuildClient: async ({ allConsoleLogs }) => {
|
||||
// Check for HMR output as enabled by default
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('TypeScript App Bundling /', () => {
|
||||
testServer: 'tests/server.ts',
|
||||
},
|
||||
buildDir: 'build',
|
||||
configFile: 'rspack.config.cjs',
|
||||
configFile: 'rspack.config.ts',
|
||||
customAssertions: {
|
||||
afterRun: async ({ result, tempDir }) => {
|
||||
// SCSS styles support
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"devDependencies": {
|
||||
"@graphql-tools/webpack-loader": "^7.0.0",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
"@rspack/plugin-react-refresh": "^1.4.3",
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.28.3",
|
||||
"@babel/preset-react": "^7.23.3",
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"meteor-node-stubs": "^1.2.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
"meteor-node-stubs": "^1.2.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"picocolors": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"meteor-node-stubs": "^1.2.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"react-dom": "^17.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const { defineConfig } = require('@meteorjs/rspack');
|
||||
const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
||||
import { defineConfig } from "@meteorjs/rspack";
|
||||
import { TsCheckerRspackPlugin } from "ts-checker-rspack-plugin";
|
||||
|
||||
/**
|
||||
* Rspack configuration for Meteor projects.
|
||||
@@ -11,10 +11,8 @@ const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
|
||||
*
|
||||
* Use these flags to adjust your build settings based on environment.
|
||||
*/
|
||||
module.exports = defineConfig(Meteor => {
|
||||
export default defineConfig((/* Meteor */) => {
|
||||
return {
|
||||
plugins: [
|
||||
new TsCheckerRspackPlugin(),
|
||||
],
|
||||
plugins: [new TsCheckerRspackPlugin()],
|
||||
};
|
||||
});
|
||||
@@ -17,7 +17,7 @@
|
||||
"vue-router": "^4.2.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@meteorjs/rspack": "^0.0.60",
|
||||
"@meteorjs/rspack": "^0.0.61",
|
||||
"@rsdoctor/rspack-plugin": "^1.2.3",
|
||||
"@rspack/cli": "^1.6.0",
|
||||
"@rspack/core": "^1.6.0",
|
||||
|
||||
@@ -552,6 +552,30 @@ module.exports = defineConfig(Meteor => ({
|
||||
}));
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
A reported use case for this is with the `thread-stream` dependency, a transitive dependency of Mongo packages. If you get this error:
|
||||
|
||||
``` shell
|
||||
Error: Cannot find module '/_build/main-dev/lib/worker.js'
|
||||
```
|
||||
|
||||
It means the worker can’t be found. Let the Node/Meteor ecosystem handle this dependency so it can automatically pick the right worker.
|
||||
|
||||
``` js
|
||||
module.exports = defineConfig((Meteor) => {
|
||||
return {
|
||||
// ..
|
||||
...Meteor.compileWithMeteor([
|
||||
// ..
|
||||
"thread-stream"
|
||||
]),
|
||||
};
|
||||
});
|
||||
```
|
||||
|
||||
More info in [this forum post](https://forums.meteor.com/t/new-3-4-beta-12-release-faster-builds-smaller-bundles-and-modern-setups-with-the-rspack-integration/64124/94).
|
||||
|
||||
### Cache
|
||||
|
||||
Meteor cache remains active and continues to handle Atmosphere packages and intermediate builds. There’s an additional cache layer managed by Rspack to speed up rebuilds for your app code.
|
||||
@@ -692,6 +716,19 @@ new GenerateSW({
|
||||
})
|
||||
```
|
||||
|
||||
### Dev Server
|
||||
|
||||
You can customize the Rspack dev server much like you would when using meteor run. Any [devServer option listed in the official Rspack guide](https://rspack.rs/config/dev-server) can be applied in your app’s [`rspack.config.js`](./rspack-bundler-integration.md#custom-rspackconfigjs).
|
||||
|
||||
The only exception is the port configuration. To set a specific port for the Rspack dev server, use the `RSPACK_DEVSERVER_PORT` environment variable:
|
||||
|
||||
```bash
|
||||
# Assign a specific port for the Rspack dev server
|
||||
RSPACK_DEVSERVER_PORT=3232 meteor run
|
||||
```
|
||||
|
||||
The reason is that the Rspack dev server is handled by the Meteor so it can make both dev server works together, and the info of the port needs to be properly shared via the env.
|
||||
|
||||
## Benefits
|
||||
|
||||
Meteor–Rspack integration sends your app code to Rspack to use modern bundler features. Meteor then uses Rspack’s output to handle Meteor-specific tasks (like Atmosphere package compilation) and create the final bundle.
|
||||
|
||||
@@ -99,7 +99,7 @@ If you find any issues, please report them to the [Meteor issues tracker](https:
|
||||
|
||||
#### Bumped NPM Packages
|
||||
|
||||
- @meteorjs/rspack@0.0.60
|
||||
- @meteorjs/rspack@0.0.61
|
||||
|
||||
#### Special thanks to
|
||||
|
||||
|
||||
Reference in New Issue
Block a user