Skip to content

Commit

Permalink
fix: set .mjs file type to javascript/auto
Browse files Browse the repository at this point in the history
Fixes errors like:
```
Can't import the named export 'computed' from non EcmaScript module (only default export is available)
```

when using `pinia`.
  • Loading branch information
haoqunjiang committed Oct 28, 2021
1 parent f128c0c commit 15b1e1b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/@vue/cli-service/lib/config/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ module.exports = (api, options) => {
webpackConfig.module
.noParse(/^(vue|vue-router|vuex|vuex-router-sync)$/)

webpackConfig.module
.rule('mjs')
.test(/\.mjs$/)
.include
.add(/node_modules/)
.end()
.type('javascript/auto')

// js is handled by cli-plugin-babel ---------------------------------------

// vue-loader --------------------------------------------------------------
Expand Down

0 comments on commit 15b1e1b

Please sign in to comment.