Stencil: Can't import the named export 'a' from non EcmaScript module

Created on 2 Sep 2019  路  10Comments  路  Source: ionic-team/stencil

Stencil version:

@stencil/[email protected]

I'm submitting a:

  • [x] bug report

Current behavior:
Works from Angular and React, but I have the following warning building from Vue.js:

 error  in ../dist/esm-es5/loader.mjs

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

 error  in ../dist/esm-es5/loader.mjs

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

Expected behavior:
Be able to use the web component from Vue.js too :)

Steps to reproduce:

Other information:
This is the current configuration: https://github.com/proyecto26/ion-phaser/blob/master/package.json#L18

Thanks in advance!

triage

Most helpful comment

I had this issue also with Vue and webpack 4.41.2 when using either lerna or npm link-ing the components. The fix for me was to add chainWebpack: config => config.resolve.symlinks(false), to the vue.config.js file

This answer works for me too with Vue 2.6.11 which uses Webpack 4.43 (at the moment). I have generated the app with Vue CLI and I had to create the file vue.config.js on app root:

module.exports = {
  chainWebpack: config => config.resolve.symlinks(false)
}

All 10 comments

Same problem here!

@jdnichollsc @CookieCookson have either of you had it running before with a previous version of stencil? I'm getting the same error in 1.3.3

Ok, it was fixed in my case by using namedExports as you can see here https://github.com/proyecto26/ion-phaser/blob/master/stencil.config.ts#L6
But I have other problem with the size of the bundle https://github.com/proyecto26/ion-phaser/issues/7

hmm I don't import anything in any of my components other than @stencil/core, I only have devDependencies so there's nothing really to add into namedExports.

I managed to solve this issue by upgrading webpack from 4.29.6 to 4.41.2. I think there was some sort of support issue for .mjs files in the older version.

I can confirm this works for me too with a higher webpack version, thanks @piemasters

I had this issue also with Vue and webpack 4.41.2 when using either lerna or npm link-ing the components. The fix for me was to add chainWebpack: config => config.resolve.symlinks(false), to the vue.config.js file

I had this issue also with Vue and webpack 4.41.2 when using either lerna or npm link-ing the components. The fix for me was to add chainWebpack: config => config.resolve.symlinks(false), to the vue.config.js file

This answer works for me too with Vue 2.6.11 which uses Webpack 4.43 (at the moment). I have generated the app with Vue CLI and I had to create the file vue.config.js on app root:

module.exports = {
  chainWebpack: config => config.resolve.symlinks(false)
}

I had this issue also with Vue and webpack 4.41.2 when using either lerna or npm link-ing the components. The fix for me was to add chainWebpack: config => config.resolve.symlinks(false), to the vue.config.js file

This answer works for me too with Vue 2.6.11 which uses Webpack 4.43 (at the moment). I have generated the app with Vue CLI and I had to create the file vue.config.js on app root:

module.exports = {
  chainWebpack: config => config.resolve.symlinks(false)
}

We also used a similar setup and encountered same issue, but for me above fix did not work.

The following syntax did work (as described in vue documentation)
chainWebpack: (config) => { config.resolve.symlinks(false); },

I had the same issue for the past couple days and finally found the culprit after comparing every config line with the next.js with-stencil example.

Turns out: setting extras.dynamicImportShim to false breaks their import.

Had this happen on 1.16.x and 1.17.x so far.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kensodemann picture kensodemann  路  3Comments

lcswillems picture lcswillems  路  3Comments

elmariofredo picture elmariofredo  路  3Comments

harshabonthu picture harshabonthu  路  3Comments

bekliev picture bekliev  路  3Comments