I know there are many questions/answers out there but none of them seems to help me resolve my issue. I don't understand what is wrong with my setup:
Here is my webpack.config.js:
var path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'ftux-components.js',
library: "shared-components",
libraryTarget: "umd"
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules)/,
loader: 'babel',
query: {
presets: ['env', 'react', 'es2015', 'stage-0'],
plugins: ["transform-class-properties"]
}
},
{
test: /\.s?css$/,
loaders: ['style', 'css', 'sass', 'postcss-loader']
},
{
test: /\.(ttf|eot|svg|jpg|png|woff)$/,
loader: 'url-loader'
}
],
rules: [
{
test: /\.js$/,
include: path.resolve(__dirname, 'src'),
exclude: /(node_modules|bower_components|build)/,
use: {
loader: 'babel-loader',
options: {
presets: ['env']
}
}
}
]
},
externals: {
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react'
},
'react-dom': {
root: 'ReactDOM',
commonjs2: 'react-dom',
commonjs: 'react-dom',
amd: 'react-dom'
},
'styled-components': {
commonjs: 'styled-components',
commonjs2: 'styled-components',
amd: 'styled-components'
}
}
};
Here's my babelrc:
{
"presets": ["env", "react", "es2015", "stage-0"],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
"transform-react-jsx"
]
}
I tried reordering presets, adding appropriate plugins (transform-class-properties), deleting reinstalling node_modules but nothing seems to help. My npm and node is up-to-date, also tried using this to make sure I included everything I need for babel. Any suggestions?