Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rspack] Error with Angular CLI project #73

Closed
edbzn opened this issue Jan 23, 2025 · 2 comments
Closed

[Rspack] Error with Angular CLI project #73

edbzn opened this issue Jan 23, 2025 · 2 comments

Comments

@edbzn
Copy link

edbzn commented Jan 23, 2025

Hey,

I get an error while using Rspack with fresh Angular CLI project:

  1. Generate new project & install deps
ng new test-rspack
npm i @rspack/cli @ng-rspack/build
  1. Create rspack config
const {createConfig} = require("@ng-rspack/build");

module.exports = createConfig({
  root: __dirname,
  outputPath: "dist/browser",
  name: 'test-rspack',
  main: './src/main.ts',
  index: './src/index.html',
  tsConfig: './tsconfig.app.json',
  styles: ["./src/styles.css"],
  polyfills: ["zone.js"],
  assets: ["./public"],
});
  1. Run npx rspack build, it outputs:
node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

SyntaxError: /xxx/test-rspack/src/app/app.routes.ts: Missing initializer in const declaration. (3:19)

  1 | import { Routes } from '@angular/router';
  2 |
> 3 | export const routes: Routes = [];
    |                    ^
  4 |
    at constructor (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:359:19)
    at Parser.raise (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:3327:19)
    at Parser.parseVar (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:13004:16)
    at Parser.parseVarStatement (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12843:10)
    at Parser.parseStatementContent (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12458:23)
    at Parser.parseStatementLike (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12375:17)
    at Parser.parseStatementListItem (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12355:17)
    at Parser.parseExportDeclaration (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:13535:17)
    at Parser.maybeParseExportDeclaration (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:13494:31)
    at Parser.parseExport (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:13419:29)
    at Parser.parseStatementContent (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12488:27)
    at Parser.parseStatementLike (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12375:17)
    at Parser.parseModuleItem (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12352:17)
    at Parser.parseBlockOrModuleBlockBody (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12929:36)
    at Parser.parseBlockBody (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12922:10)
    at Parser.parseProgram (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12249:10)
    at Parser.parseTopLevel (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:12239:25)
    at Parser.parse (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:14089:10)
    at parse (/xxx/test-rspack/node_modules/@babel/parser/lib/index.js:14123:38)
    at parser (/xxx/test-rspack/node_modules/@babel/core/lib/parser/index.js:41:34)
    at parser.next (<anonymous>)
    at normalizeFile (/xxx/test-rspack/node_modules/@babel/core/lib/transformation/normalize-file.js:64:37)
    at normalizeFile.next (<anonymous>)
    at run (/xxx/test-rspack/node_modules/@babel/core/lib/transformation/index.js:22:50)
    at run.next (<anonymous>)
    at transform (/xxx/test-rspack/node_modules/@babel/core/lib/transform.js:22:33)
    at transform.next (<anonymous>)
    at step (/xxx/test-rspack/node_modules/gensync/index.js:261:32)
    at /xxx/test-rspack/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/xxx/test-rspack/node_modules/gensync/index.js:223:11)
    at /xxx/test-rspack/node_modules/gensync/index.js:189:28
    at /xxx/test-rspack/node_modules/@babel/core/lib/gensync-utils/async.js:67:7
    at /xxx/test-rspack/node_modules/gensync/index.js:113:33
    at step (/xxx/test-rspack/node_modules/gensync/index.js:287:14)
    at /xxx/test-rspack/node_modules/gensync/index.js:273:13
    at async.call.result.err.err (/xxx/test-rspack/node_modules/gensync/index.js:223:11)

Node.js v22.12.0

Note that I don't have the issue with Rsbuild.

@Coly010
Copy link
Owner

Coly010 commented Jan 23, 2025

Yeah I've also just encountered this. Currently Investigating

@Coly010
Copy link
Owner

Coly010 commented Jan 23, 2025

Fixed in latest - advancedOptimizations causing an issue

@Coly010 Coly010 closed this as completed Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants