Skip to content
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

--next build error: Components with "assetDir" or "assetDirs" set do not copy the folder to the www directory #2120

Closed
splitinfinities opened this issue Jan 8, 2020 · 2 comments
Labels

Comments

@splitinfinities
Copy link
Contributor

splitinfinities commented Jan 8, 2020

Stencil version:

 @stencil/core@1.9.0-10

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:
Folders set on a component in the "assetsDirs" and "assetsDir" aren't copied to the /www/build directory.

On a production build - not a watch process - they are copied to the dist/{namespace}/ directory - so that's good.

You can visit this repo to reproduce: https://github.com/splitinfinities/Stellar/tree/beta

Expected behavior:
Should be copying the themes/ directory into the www/build/ directory on initial build.

Steps to reproduce:
I have a google maps component that has a theme attribute. That theme attribute typically loads a json file that styles the google map.

I define the google maps component as shown below, then run npm start - however the www directories look like:
Screen Shot 2020-01-08 at 11 02 18 AM

where running npm run build.prod produces the expected result:
Actually, this happens with production builds as well.
Screen Shot 2020-01-08 at 11 53 35 AM

Related code:

@Component({
  tag: 'stellar-google-maps',
  styleUrl: 'map.css',
  assetsDirs: ["themes"]
 // assetDir: "themes" also behaves the same way
})
export class Map {

  // other stuff...

  @Prop() theme: string = "default";

  @Watch('theme')
  async handleTheme() {
    let styles = [];

    if (this.theme) {
      styles = await (await fetch(getAssetPath(`./themes/${this.theme}.json`))).json();
    }

    this.map.setOptions({ styles })
  }

  // other stuff...

  render () {
    return <div id="map" />
  }
}

Other information:

@ionitron-bot ionitron-bot bot added the triage label Jan 8, 2020
@splitinfinities
Copy link
Contributor Author

Edited all this copy because wowza do I need to proofread before I publish more often lol.

@splitinfinities
Copy link
Contributor Author

I take that back - it also happens in the dist directory. I hadn't added the --next flag to the build script.

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

No branches or pull requests

1 participant