stencil icon indicating copy to clipboard operation
stencil copied to clipboard

namespace with more than one "-" don't generate correct bundle

Open romulocintra opened this issue 7 years ago • 6 comments

Stencil version:

 @stencil/[email protected]

I'm submitting a:

[ x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:


//This generates my-button.esm.js 
export const config: Config = {
  namespace: 'my-button',
 ... 
}

//This won't generate : my-button-template.esm.js
export const config: Config = {
  namespace: 'my-button-template',
 ... 
}

Expected behavior:


//Output should be =>  my-button-template.esm.js
export const config: Config = {
  namespace: 'my-button-template',
 ... 
}

romulocintra avatar Apr 30 '19 20:04 romulocintra

what's the output then?

manucorporat avatar May 01 '19 09:05 manucorporat

what's the output then?

The output for 'my-button-template' should be my-button-template.esm.js but results in my-button.js , if i use as namespace in stencil.config my-button final result is my-button.esm.js .

romulocintra avatar May 01 '19 11:05 romulocintra

@manucorporat only happens if your namespace is the same of your component. probably it should give some feedback . will close

romulocintra avatar May 01 '19 21:05 romulocintra

@manucorporat Wow, this one is a nasty gotcha! You might reopen this. I just spent an hour trying to figure out why Stencil One does not generate .esm.js file for my component and as I just found out thanks to @romulocintra's ticket, it happens when you have - in the component name and the namespace is of the same name.

smajl avatar May 20 '19 11:05 smajl

Ah! I was really confused for a while as to why this was—thank you!

I'm not 100% sure but d58bea6 may solve for this. That's on master but not yet released at the time of this writing (beta-5).

emilio-martinez avatar May 29 '19 07:05 emilio-martinez

Very interesting bug and glad others had already found it. Thanks!

I am using Storybook with Stencil, and all of a sudden Storybook started failing due to the esm directory not being generated when building the components.

Like @smajl mentioned, the solution for me was to change my component's name from manny-right-menu to manny-menu, then I ran a build again and sure enough, the esm directory was created.

I encountered the issue with these package versions.

  "dependencies": {
    "@stencil/core": "^2.13.0"
  },
  "devDependencies": {
    "@babel/core": "^7.17.10",
    "@storybook/addon-actions": "^6.4.22",
    "@storybook/addon-essentials": "^6.4.22",
    "@storybook/addon-links": "^6.4.22",
    "@storybook/html": "^6.4.22",
    "@types/jest": "^27.0.3",
    "babel-loader": "^8.2.5",
    "jest": "^27.4.5",
    "jest-cli": "^27.4.5",
    "puppeteer": "^10.0.0"
  }

MannyDiera avatar May 13 '22 11:05 MannyDiera