-
-
Notifications
You must be signed in to change notification settings - Fork 20
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: Unexpected token 'export' #44
Comments
Can you please give more context how are you doing things?
Additionally, it'd be easier to help you if you uploaded a sample app reproducing the issue. |
Not really sure what changed between 3.9 and 4.2 that would break something so baked in as |
I'll try to get an example app later today. |
here's a sample project. steps in README to reproduce error https://github.com/wolfram-fm/i18ntest |
just to rule out |
oh, now I got it. The reason is that TypeScript ( One way of doing this is loading
Then you need to import just the types from your regular import { I18n } from "i18n-js/dist/require";
import type * as I18nTypes from "i18n-js";
const tx: I18nTypes.I18n = new I18n({
en: {
hello: "hello",
},
fr: {
hello: "bonjour",
},
});
export default tx; I've attached your sample modified according to the above ( $ esbuild --bundle --minify index.ts --outfile=dist/index.js
dist/index.js 70.5kb
⚡ Done in 16ms
$ node dist/index.js
hello
bonjour |
If I use if you want to export a so the package.json should be like that: {
"main": "./dist/require/index.js",
"module": "./dist/import/index.js"
} |
Description
I have a pretty simple typescript project that runs on Docker. I tried to upgrade from 3.9.2 to 4.2.2, but have been running into issues building the project with the error
Unexpected token 'export'
. The error seems to be coming from the exports in thedist/index.js
file.The text was updated successfully, but these errors were encountered: