FredKSchott / create-snowpack-app

The all-in-one app template for Snowpack. [moved]
https://www.snowpack.dev
Other
727 stars 96 forks source link

Babel Plugin import not working with snowpack #149

Closed haikyuu closed 4 years ago

haikyuu commented 4 years ago

To reproduce, just install lodash, and babel-plugin-import and create a babelrc file like this:

module.exports = {
    "plugins": [
        [
            "import",
            {
                "libraryName": "lodash",
                "libraryDirectory": "",
                "camel2DashComponentName": false
            },
            "lodash"
        ]
    ]
}

Here is my snowpack config:

module.exports = {
  "extends": "@snowpack/app-scripts-react",
  "scripts": {
    "bundle:*": "@snowpack/plugin-webpack"
  },
  "plugins": [
    "@snowpack/plugin-babel",
    [
      "@snowpack/plugin-webpack",
      {
        "sourceMap": true,
        extendConfig: (config) => {
          // config.plugins.push(/* ... */);
          return config;
        },
      }
    ]
  ],
  "proxy": {
    "/api": "http://127.0.0.1:4000"
  }
}

This is the error i get when building:

Snowpack

  ./build Building your application...

  mount:web_modules.......[DONE] mount $WEB_MODULES --to /web_modules
  mount:public............[DONE] mount public --to /
  mount:src...............[DONE] mount src --to /_dist_
  run:tsc.................[DONE] tsc --noEmit
  build:js,jsx,ts,tsx.....[RUNNING] (plugin) @snowpack/plugin-babel
  bundle:*................[READY] (plugin) @snowpack/plugin-webpack

▼ Snowpack

  Dependency lodash/groupBy not found!

 ERROR  Command failed with exit code 1.
FredKSchott commented 4 years ago

Thanks for reporting! Duplicate of https://github.com/pikapkg/snowpack/issues/475