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

[Bug]: Library name syntax #8044

Closed
natocTo opened this issue Oct 2, 2024 · 1 comment
Closed

[Bug]: Library name syntax #8044

natocTo opened this issue Oct 2, 2024 · 1 comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.

Comments

@natocTo
Copy link

natocTo commented Oct 2, 2024

System Info

System:
- OS: macOS 14.5
- CPU: (11) arm64 Apple M3 Pro
- Memory: 130.86 MB / 18.00 GB
- Shell: 5.9 - /bin/zsh

Binaries:
- Node: 20.15.1 - /opt/homebrew/bin/node
- Yarn: 1.22.22 - ~/Documents/GitHub/ui/node_modules/.bin/yarn
- npm: 10.2.3 - ~/Documents/GitHub/ui/node_modules/.bin/npm

Browsers:
- Chrome: 129.0.6668.89
- Safari: 17.5

Details

When library name is configured based on docs - https://rspack.dev/config/output#outputlibraryname

module.exports = {
  // …
  output: {
    library: {
      name: 'MyLibrary',
      export: 'default'
    },
  },
};

It fails on schema validation before build:

Invalid configuration object. Rspack has been initialized using a configuration object that does not match the API schema.
│ - Unrecognized key(s) in object: 'name', 'export' at "output.library"
│ [rspack-cli] [Error:   × Library name must be a string or string array. Common configuration options that specific library names are 'output.library[.name]', 'entr
│ y.xyz.library[.name]', 'ModuleFederationPlugin.name' and 'ModuleFederationPlugin.library[.name]'.
│ ] {
│   code: 'GenericFailure'
│ }

It works for "older" syntax, but it is "deprecated" - https://rspack.dev/config/output#outputlibraryexport-1

module.exports = {
  // …
  output: {
    library: 'MyLibrary',
    libraryExport: 'default'
  },
};

Reproduce link

No response

Reproduce Steps

  1. use newer library name syntax
  2. try build library
@natocTo natocTo added bug Something isn't working pending triage The issue/PR is currently untouched. labels Oct 2, 2024
@natocTo
Copy link
Author

natocTo commented Oct 2, 2024

I now see it works when "type" is also defined. 👍 So maybe just mention this in the documentation. Or somehow tune validation, it was not clear what is wrong.


Btw, I would not expect that migration from Webpack would be that "simple". Great work.

@natocTo natocTo closed this as completed Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage The issue/PR is currently untouched.
Projects
None yet
Development

No branches or pull requests

1 participant