Closed afhaque closed 7 years ago
Hm interesting. I haven't had time to test with webpack yet and honestly not that familiar with it. Did you run npm install
first? babel-plugin-transform-object-assign is in the package.json so shouldn't be a problem. The plugin is then added in the .babelrc and is named transform-object-assign. Either babel has changed anything or something is different with webpack.
Please feel free to send in a PR if you find a solution. I will test with webpack as well as soon as I get some time over, busy times before the vacation :/
Thanks for reporting it!
@afhaque this worked for my while using another component with the same error...
https://github.com/akiran/react-slick/issues/433
lib contains files that are already transpilied by babel You have to exclude node_modules in babel loader webpack config
module: {
loaders: [{
exclude: /node_modules/,
test: /\.js$/,
loader: "babel"
}]
}
I ran into the same issue installing react-slick. I got it working by installing transform-object-assign
(https://www.npmjs.com/package/babel-plugin-transform-object-assign) and then putting "plugins": ["transform-object-assign"]
in my ,babelrc
file. In my webpack file I'm doing it like this:
plugins: [ new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery", ReactSlick: 'react-slick' }) ]
Then in your react file you can import it: import SlickSlider from 'react-slick';
Hope this works for other people!
Thanks @marcianosr - worked a treat.
Ran into this issue when running webpack to compile.
Module build failed: ReferenceError: Unknown plugin "transform-object-assign" sp ecified in "D:\\CodeWork\\React-HWs\\NYT-React\\node_modules\\react-popup\\.babe lrc" at 0, attempted to resolve relative to "D:\\CodeWork\\React-HWs\\NYT-React\ \node_modules\\react-popup"