const path = require('path'); | |
const TerserPlugin = require('terser-webpack-plugin'); | |
module.exports = { | |
context: __dirname, | |
entry: './frontend/facenovel.jsx', | |
output: { | |
path: path.resolve(__dirname, 'app', 'assets', 'javascripts'), | |
filename: 'bundle.js' | |
}, | |
resolve: { | |
extensions: ['.js', '.jsx', '*'] | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /(node_modules)/, | |
use: { | |
loader: 'babel-loader', | |
options: { | |
presets: ['@babel/preset-env', '@babel/preset-react'], | |
} | |
}, | |
} | |
] | |
}, | |
devtool: 'source-map', | |
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', | |
optimization: { | |
minimizer: [ | |
new TerserPlugin({ | |
extractComments: false, | |
terserOptions: { | |
compress: { | |
drop_console: true, // Remove console.log statements | |
}, | |
output: { | |
comments: false, // Remove comments | |
}, | |
} | |
}), | |
], | |
} | |
}; | |