developit / preact-redux

:loop: Preact integration for Redux (no shim needed!)
https://npm.im/preact-redux
MIT License
288 stars 26 forks source link

npm dependencies not being installed #19

Closed tkbremnes closed 7 years ago

tkbremnes commented 7 years ago

The dev dependencies are no longer being installed properly.

electerious commented 7 years ago

What's the error you get? What's not working?

tkbremnes commented 7 years ago

Been experimenting a bit more now, and see that this only happens in one of the two projects I have set this up. Trying to figure out what is different between the two, but haven't come across anything that has helped yet.

Anyway, this is what I do, and what happens:

1) I add preact-redux to my project (project is using preact cli) 2) I run npm install 3) When I run the project, error messages like the one below shows up.

Module build failed: ReferenceError: Unknown plugin "transform-node-env-inline" specified in "/Volumes/Dev/appearin/peregrin copy/node_modules/preact-redux/.babelrc" at 0, attempted to resolve relative to "/Volumes/Dev/appearin/peregrin copy/node_modules/preact-redux"
    at /Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:180:17
    at Array.map (native)
    at Function.normalisePlugins (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
    at OptionManager.mergeOptions (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
    at OptionManager.init (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/file/index.js:212:65)
    at new File (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/file/index.js:135:24)
    at Pipeline.transform (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-loader/lib/index.js:48:20)
    at /Volumes/Dev/appearin/peregrin copy/node_modules/babel-loader/lib/fs-cache.js:118:18
    at ReadFileContext.callback (/Volumes/Dev/appearin/peregrin copy/node_modules/babel-loader/lib/fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
 @ ./index.js 17:0-40
 @ ./~/preact-cli/lib/lib/entry.js
 @ multi ./~/preact-cli/lib/lib/entry webpack-dev-server/client?http://0.0.0.0:8080/ webpack/hot/dev-server?http://0.0.0.0:8080/

This error is resolved if I manually install the modules as dev dependencies. In my case there are three: babel-plugin-transform-node-env-inline, babel-preset-es2015 and babel-preset-react.

electerious commented 7 years ago

I've the same error. It seems that babel thinks it should use the .babelrc located in node_modules/preact-redux. It's not a problem of preact-redux, but I currently can't tell where the issue is coming from.

I made a PR for preact-redux that only publishes required files to npm (without the .babelrc). Deleting the .babelrc manually works, too: https://github.com/developit/preact-redux/pull/18

PR has been merged, but is not on npm, yet. Maybe @developit can do a patch release and publish it to npm as a temporary workaround.

tkbremnes commented 7 years ago

Odd.

But thanks, and sorry for jumping to conclusions on where the issue originated :)

developit commented 7 years ago

I'll try to get a release out today with that and the ESM fix.

developit commented 7 years ago

Fixed in 2.0.2.