Git Product home page Git Product logo

Comments (9)

heiemooa avatar heiemooa commented on June 29, 2024

There is actually en-US.d.ts, but there is no en-US.js file

from rollup.

heiemooa avatar heiemooa commented on June 29, 2024

I want to keep these files from being discarded by treeshake。
locale inludes:
| -- en.ts
| -- zh.ts
| -- index.ts

from rollup.

lukastaegert avatar lukastaegert commented on June 29, 2024

How can those files be needed when nothing imports them?

from rollup.

heiemooa avatar heiemooa commented on June 29, 2024

Thanks for the feedback!

For example, when I was developing a component library. I may only quote and use a certain language by default, but not all languages.

If the user wants to switch languages ​​during use, they can manually import it from '/module/locale/fr_FR'; then pass it to the component. So the component uses another language.

like https://ant.design/docs/react/i18n

import { ConfigProvider } from 'antd';
import frFR from 'antd/locale/fr_FR';

return (
  <ConfigProvider locale={frFR}>
    <App />
  </ConfigProvider>
);

from rollup.

heiemooa avatar heiemooa commented on June 29, 2024

But the current situation, for example, my locale includes multiple languages, but if I only reference one default language, then the other languages ​​will not be included in the built package, but they are actually needed. Is there any way to solve this problem?

image

from rollup.

lukastaegert avatar lukastaegert commented on June 29, 2024

If you want users to be able to manually import anything, you need to make all languages entry points. Otherwise even if they were bundled, they would just end up in some file and would be entirely unusable.

from rollup.

heiemooa avatar heiemooa commented on June 29, 2024

I understand what you mean, but if I quote it like this, I can't package it into /esm. Is there any better solution? Does treeshake support it? If supported, how to configure it?
image

from rollup.

lukastaegert avatar lukastaegert commented on June 29, 2024

Not sure I understand you. By entry point I mean adding all languages as entry points to the input option.

from rollup.

heiemooa avatar heiemooa commented on June 29, 2024

Sorry, maybe I don't understand what you mean. Would you mind helping me change the code so that files in _locale can also be packaged into the /esm/_locale/ directory? The en_US.js file is now missing

DEMO: [email protected]:heiemooa/rollup-language-input.git

image

from rollup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.