Closed shpyo closed 7 years ago
That error likely means that emotion's babel plugin isn't running, it's likely that there's another .babelrc
or something overwriting the babel config. Try adding babelrc: false
to the babel-loader
options in your webpack config to force babel to use that config.
{
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
[
'env',
{
targets: {
browsers: ['last 2 versions', 'ie >= 11']
}
}
],
'react'
],
plugins: [
'emotion',
'transform-object-rest-spread',
'transform-decorators-legacy',
'transform-class-properties',
'transform-export-extensions',
'transform-runtime',
'rewire'
]
}
}
Your environment might also be test
which would not pickup the emotion plugin from dev
.
Thanks for all replies!
@mitchellhamilton I added that prop to ignore .babelrc
and still got the same error.
@greggb So.. I created a test
env in my .babelrc
- still got that error
I'm wondering if this is a webpack issue that loads wrong plugins.
Hmm, my next step would be reducing the config as much as possible to see if it works. Would it be possible to remove your webpack babel config and use just the babelrc to see if it will work?
@greggb tip with config was very helpful! I had to remove whole options
in babel-loader
and setup test
environment in .babelrc
.
I'm closing this ticket.
Glad it worked!
Hey, I'm facing one issue that I can't find the root cause. Everything works fine until I run tests. There is an issue with
styled.div
which throws an error:Some details about my project
emotion
version:8.0.9
react
version:16.0.0
.babelrc
config:And here is my
webpack.config.test.js
:And here a source of that file:
Did I missed something? Any clues or ideas?