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

Can it support multiple output with different libraryNames? #14

Closed
ZhangTaibin opened this issue Dec 18, 2024 · 5 comments
Closed

Can it support multiple output with different libraryNames? #14

ZhangTaibin opened this issue Dec 18, 2024 · 5 comments

Comments

@ZhangTaibin
Copy link

ZhangTaibin commented Dec 18, 2024

I get multiple output through this options:

import { defineConfig } from '@rsbuild/core';

export default defineConfig({
  source: {
    entry: {
      "component-1": "./src/component-1/index.js",
      "component-2": "./src/component-2/index.js",
    }
  },

  output: {
    filename: {
      js: '[name]/index.[contenthash:8].js',
    },
  },
});

It will get dist/component-1/index.jsdist/component-2/index.js .

I want all the index.js having a libraryName when I use this UMD plugin. But it only supports setting a single name.

@chenjiahan
Copy link
Member

Hi, it is recommended to use Rslib if you are building component libraries.

@ZhangTaibin
Copy link
Author

OK, thanks

@ZhangTaibin
Copy link
Author

Rslib fail too. All output use a same umdName.

I want every js use different names. Just like this output with Rollup:

import { defineConfig } from 'rollup'

export default defineConfig([
    {
        input: 'src/component-1/index.js',
        output: [
            {
                name: 'component__1',
                file: 'dist/component-1/index.js',
                format: 'umd',
            },
        ],
    },
    {
        input: 'src/component-2/index.js',
        output: [
            {
                name: 'component__2',
                file: 'dist/component-2/index.js',
                format: 'umd',
            },

        ],
    },
])

@ZhangTaibin ZhangTaibin reopened this Dec 19, 2024
@ZhangTaibin ZhangTaibin changed the title Can it support multiple output? Can it support multiple output with different libraryNames? Dec 19, 2024
@chenjiahan
Copy link
Member

Can you file an issue to the Rslib repo? Thanks!

@ZhangTaibin
Copy link
Author

ZhangTaibin commented Dec 19, 2024

Ok. I file the issue #579

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