Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Example not working #9

Open
stephane303 opened this issue Jun 29, 2021 · 5 comments
Open

Example not working #9

stephane303 opened this issue Jun 29, 2021 · 5 comments

Comments

@stephane303
Copy link

stephane303 commented Jun 29, 2021

In the example folder, I did an npm install and npm dev:

ERROR  Failed to compile with 2 errors                                                                     
 error  in ./node_modules/vue-i18n-composable/dist/index.mjs

Can't import the named export 'computed' from non EcmaScript module (only default export is available)

 error  in ./node_modules/vue-i18n-composable/dist/index.mjs

Can't import the named export 'getCurrentInstance' from non EcmaScript module (only default export is available)

When doing the npm install I choose version 0.2.2 of vue-i18n-composable

@caugner
Copy link

caugner commented Aug 9, 2021

@stephane303 I'm experiencing the same issue. Have you found a workaround, by any chance?

PS: Maybe these tsconfig.json settings are to restrictive:

"target": "es2017",
"module": "esnext",

In my project, we have them set to:

    "target": "ES6",
    "module": "ES2015",

@caugner
Copy link

caugner commented Aug 9, 2021

cc @antfu: Writing import { useI18n } from 'vue-i18n-composable' like in the example, causes the following error:

Failed to compile.

./node_modules/vue-i18n-composable/dist/index.mjs 17:17-25
Can't import the named export 'computed' from non EcmaScript module (only default export is available)

@caugner
Copy link

caugner commented Aug 9, 2021

@stephane303
Copy link
Author

stephane303 commented Aug 9, 2021

@stephane303 I'm experiencing the same issue. Have you found a workaround, by any chance?

PS: Maybe these tsconfig.json settings are to restrictive:

"target": "es2017",
"module": "esnext",

In my project, we have them set to:

    "target": "ES6",
    "module": "ES2015",

My workaround has been to copy the file https://github.com/intlify/vue-i18n-composable/blob/master/src/index.ts directly in my project, it's dirty, but its working

@kazupon
Copy link
Member

kazupon commented Aug 10, 2021

for example, you need to configure the following vue.config.js:

module.exports = {
  configureWebpack: (config) => {
    config.module.rules.push({
      test: /\.mjs$/,
      type: 'javascript/auto',
    })
  },
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants