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

Angular CLI workspace with several projects #36

Open
manfredsteyer opened this issue Jan 3, 2025 · 3 comments
Open

Angular CLI workspace with several projects #36

manfredsteyer opened this issue Jan 3, 2025 · 3 comments

Comments

@manfredsteyer
Copy link

I have an Angular CLI workspace with several projects. When compiling one of them using

npx rsbuild build -c projects/mfe1/rsbuild.config.ts

I get this error message:

error   Failed to build.
error   [rsbuild:html] Failed to resolve HTML template, please check if the file exists: /Users/manfredsteyer/projects/public/ng-rspack/src/index.html

Here is the entire stack trace:

    at getTemplate (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:3436:54)
    at async file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:3478:95
    at async Promise.all (index 0)
    at async Object.handler (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:3459:227)
    at async Object.callInEnvironment (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:2388:30)
    at async modifyBundlerChain (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:4955:124)
    at async generateRspackConfig (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:5116:248)
    at async Promise.all (index 0)
    at async initConfigs (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:5250:25)
    at async createCompiler_createCompiler (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:6352:52)
    at async build_build (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:6405:22)
    at async Object.build (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:6976:29)
    at async Command.<anonymous> (file:///Users/manfredsteyer/projects/public/ng-rspack/node_modules/@rsbuild/core/dist/index.js:7081:41)
@Coly010
Copy link
Owner

Coly010 commented Jan 6, 2025

The createConfig util supports a root option that sets the rsbuild's root for execution, have you set it?

createConfig({
  root: __dirname,
  index: './src/index.html'
})

If you have and this is still occurring there may need to be a way to normalize the path regardless of where npx rsbuild is called from, which is the real root cause here.

@manfredsteyer
Copy link
Author

Thanks. I'll try it out and let you know here.

@eilensm
Copy link

eilensm commented Jan 7, 2025

Hi, I'm also having a project in a sub directory. I use the root option, but I'm not sure what exactly this option should do. As @Coly010 stated, it should be the root for rsbuild. But for me, rsbuild always looks for the tsconfig.app.json in the cwd and not in the root directory. Is this the expected behaviour?
Thus, I always have to set the tsconfigPath option or cd into the project directory.

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

3 participants