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

[BUG] [3.1.2] Fail to esinstall node_modules files with .svg extensions #2999

Closed
4 tasks done
harleylang opened this issue Mar 25, 2021 · 1 comment
Closed
4 tasks done

Comments

@harleylang
Copy link

harleylang commented Mar 25, 2021

Bug Report Quick Checklist

  • I am on the latest version of Snowpack & all plugins.
  • I use package manager npm (Fill in: npm, yarn, pnpm, etc).
  • I run Snowpack on OS Linux (Fill in: Windows, Mac, Linux, etc).
  • I run Snowpack on Node.js v12+

Describe the bug

After upgrading from 3.0.11 to 3.1.2 I am receiving an esinstall error after running npm run dev:

[13:41:17] [snowpack] + {internal-private-package}
[13:41:17] [esinstall:{the-private-package}] Failed to load ../dist/icons/{filename}.svg
Unexpected token (Note that you need plugins to import files that are not JavaScript)
[13:41:17] [snowpack] Install failed.

When I comment out the imports for that SVG file, I am also receiving errors described in #2970 for .scss extensions.

To Reproduce

Import a private npm package that includes a file that imports an .svg file.

Use the following config:

module.exports = {
    mount: {
      public: { url: '/', static: true },
      src: { url: '/dist' },
    },
    extends: "@snowpack/app-scripts-react",

//...

    plugins: [
      "@snowpack/plugin-sass",
      "snowpack-plugin-mdx"
    ],
    packageOptions: {
      external: [
        "@material-ui/core/OverridableComponent", 
        "node_modules/bootstrap/scss/_functions",
        "node_modules/bootstrap/scss/_variables",
        "node_modules/bootstrap/scss/_mixins",
        "node_modules/bootstrap/scss/_progress",
        "node_modules/bootstrap/scss/_utilities",
      ],
      rollup: {
        plugins: [
          require('@rollup/plugin-typescript')(),
          require("rollup-plugin-node-polyfills")(),
          require("rollup-plugin-scss")(),
          require("rollup-plugin-svg")()
        ],
      },
  },
}

Expected behavior

Expecting the initial snowpack caching to complete and to proceed with serving my React application.

I have temporarily downgraded to 3.0.11 and everything works as expected.

@harleylang
Copy link
Author

Reporting back; fixed with #3123.

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

No branches or pull requests

1 participant