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

Error with stencil store #72

Open
bsastregx opened this issue Jul 6, 2021 · 5 comments
Open

Error with stencil store #72

bsastregx opened this issue Jul 6, 2021 · 5 comments
Labels
Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team

Comments

@bsastregx
Copy link

bsastregx commented Jul 6, 2021

Stencil version:

@stencil/core@2.6.0

I'm submitting a:

[x] bug report
[x] 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:
I have installed @stencil/store.
It works just fine except that when I try to run storybook (i am using storybook with stencil) I get the following error :
ERROR in ./node_modules/@stencil/store/dist/index.mjs 57:59-70 Can't import the named export 'forceUpdate' from non EcmaScript module (only default export is available) @ ./dist/collection/components/store.js

Expected behavior:
Storybook would just run normally

Steps to reproduce:

Related code:

components/store.ts:

import { createStore } from "@stencil/store";

const { state } = createStore({
  large: document.documentElement.classList.contains("gxg-large"),
});

export default state;

storybook/webpack.config.js

const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const WriteFilePlugin = require("write-file-webpack-plugin");

module.exports = async ({ config }) => {
  config.entry.push(path.join(__dirname, "../dist/gemini.js"));
  config.entry.push(path.join(__dirname, "../dist/gemini/gemini.css"));
  fs.readdirSync(path.join(__dirname, "../dist/collection/components")).map(
    function(file) {
      jsFilePath = path.join(
        __dirname,
        `../dist/collection/components/${file}/${file}.js`
      );
      try {
        if (fs.existsSync(jsFilePath)) {
          config.entry.push(jsFilePath);
        }
      } catch (err) {
        console.error(err);
      }

      cssFilePath = path.join(
        __dirname,
        `../dist/collection/components/${file}/${file}.css`
      );
      try {
        if (fs.existsSync(cssFilePath)) {
          config.entry.push(cssFilePath);
        }
      } catch (err) {
        console.error(err);
      }
    }
  );

  config.plugins.push(
    new CopyPlugin([
      {
        from: "**/*",
        to: "./",
        context: "dist"
      }
    ])
  );

  config.plugins.push(new WriteFilePlugin());

  config.module.rules.push({
    test: /\.stories\.jsx?$/,
    loaders: [require.resolve("@storybook/source-loader")],
    enforce: "pre"
  });

  return config;
};
// insert any relevant code here

Other information:
Sergio Arbeo, one of the contributors of stencil core, sugested me to configure webpack so it loads correctly the dependencies.
I don't know webpack... But the error seems to be in stencil store... Please any help will be much appreciated.
error-store

@pinkkis
Copy link

pinkkis commented Oct 22, 2021

Getting the same errors, so really looking for a solution for this.

@splitinfinities
Copy link
Contributor

@pinkkis also within storybook?

@pinkkis
Copy link

pinkkis commented Oct 22, 2021

@splitinfinities Yes, correct. Both for "getRenderingRef" and "forceUpdate"

ERROR in ./node_modules/@stencil/store/dist/index.mjs 50:24-39
Can't import the named export 'getRenderingRef' from non EcmaScript module (only default export is available)
 @ ./dist/collection/store/app-store.js
 @ ./dist/collection/store/index.js
[...]

stencil/core 2.9.0, stencil/store 1.5.0, storybook/html 6.3.12

@rwaskiewicz
Copy link
Member

👋 As a bit of housekeeping, I'm going to move this issue to the Stencil Store repo

@rwaskiewicz rwaskiewicz transferred this issue from ionic-team/stencil Feb 16, 2022
@rwaskiewicz rwaskiewicz added Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team and removed Integration: Storybook labels May 27, 2022
@krishna-koushik
Copy link

any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: Needs Investigation This PR or Issue should be investigated from the Stencil team
Projects
None yet
Development

No branches or pull requests

5 participants