Comments (9)
There is actually en-US.d.ts, but there is no en-US.js file
from rollup.
I want to keep these files from being discarded by treeshake。
locale inludes:
| -- en.ts
| -- zh.ts
| -- index.ts
from rollup.
How can those files be needed when nothing imports them?
from rollup.
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.
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](https://private-user-images.githubusercontent.com/23737468/298510999-fbde1172-a20f-4aca-88d0-639868003a5e.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTAyMDg2ODksIm5iZiI6MTcxMDIwODM4OSwicGF0aCI6Ii8yMzczNzQ2OC8yOTg1MTA5OTktZmJkZTExNzItYTIwZi00YWNhLTg4ZDAtNjM5ODY4MDAzYTVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzEyVDAxNTMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0NTAxYzM5NmZiNjJhZjBiZGY5ZGEzOTM4YjA2NTRmODE4YWMwOTM0ZDhiNWU2OGU0ZTM0OTA3OWEwNzZlYTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.X_pK52K_iQTAee0up5Q-8b3rYPHj7osCBwcY0eIB2KY)
from rollup.
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.
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?
from rollup.
Not sure I understand you. By entry point I mean adding all languages as entry points to the input
option.
from rollup.
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](https://private-user-images.githubusercontent.com/23737468/302010619-b74f0a8a-057d-4cb2-acb7-117d4caab74f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTAyMDg2ODksIm5iZiI6MTcxMDIwODM4OSwicGF0aCI6Ii8yMzczNzQ2OC8zMDIwMTA2MTktYjc0ZjBhOGEtMDU3ZC00Y2IyLWFjYjctMTE3ZDRjYWFiNzRmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzEyVDAxNTMwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc1Y2IyOGU1Y2Y3Zjc5NDk0MGEyNjU4MmExMmE1M2I3Zjg2YzQzZDZhNzdiMDZiZDUzZDZkNTE5YmFkOWY1ZDAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.W5feUIFocInDeNI1q0qrx5-ZllZ3sCT8vk4RF7iwHA8)
from rollup.
Related Issues (20)
- Support for 32-bit Linux (x86/ia32)
- onLog documentation is lacking something HOT 2
- Provide format info in output.chunkFileNames callback HOT 1
- Why is rollup creating an additional file of just exports from my entry file? HOT 4
- When I use format: "es" & sourcemap: false, bundle.write outputs an es module and a systemjs module with a sourcemap HOT 1
- What has been upgraded “terser: 5.27.3” HOT 1
- Exceptional performance of `namespace import` object values
- Cannot figure out a good workflow for a Shopify site...
- Setting `moduleSideEffects: false` removes side effectful getter inside a exported function since 4.9.2 HOT 2
- Rollup incorrectly merging ESM and CJS modules resulting in missing exports
- Treeshake dynamic import of modules
- RollupError: Unexpected token `.`. Expected * for generator, private key, identifier or async HOT 3
- [dir] placeholder for `output.assetFileNames` HOT 3
- I get loads of 'Circular dependency' errors when bundling 'npm link' symlinked modules HOT 1
- Circular dependency hangs watch option
- Vue 3 Script Setup syntax + style tag scoped = bug HOT 2
- map/filter/reduce on constant arrays with property access isn't treeshaken HOT 1
- Module execution order can be incorrect when having multiple entrypoints HOT 5
- Akims8686
- Rollup should allow building from source. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rollup.