Open saitodisse opened 8 years ago
My webpack configuration is creating a main.js
with this line bellow:
class CerebralComponent extends InfernoComponent {
That's why uglify craches. 😒
This is my webpack config:
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
require('dotenv').config({path: '.env-prod'});
module.exports = {
entry: path.resolve('src', 'main.js'),
output: {
path: path.resolve('dist'),
filename: 'main.js',
publicPath: ''
},
plugins: [
new HtmlWebpackPlugin({
title: 'md list',
template: path.resolve('src', 'index.template.ejs'),
inject: 'body'
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'API_KEY': JSON.stringify(process.env.API_KEY),
'AUTH_DOMAIN': JSON.stringify(process.env.AUTH_DOMAIN),
'DATABASE_URL': JSON.stringify(process.env.DATABASE_URL),
'STORAGE_BUCKET': JSON.stringify(process.env.STORAGE_BUCKET),
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
mangle: false,
}
})
],
module: {
loaders: [
{ test: /\.js?$/,
include: path.resolve('src'),
loader: 'babel',
query: {
presets: ['es2015', 'stage-0'],
plugins: [
'inferno',
['module-alias', [
{ 'src': 'src', 'expose': '~' },
]],
]
}
},
]
}
};
cc @christanalfoni we can't use class in es5 code. @saitodisse as a workaround include cerebral-view-inferno to babel-loader
Thanks @Guria. For now I'm going to switch to React. Webpack loaders is a long road to learn.
I'm getting this error when I try to use
UglifyJs
:Already tryied to disable
mangle
but I got same error:maybe this helps: http://www.jbrantly.com/es6-modules-with-typescript-and-webpack/