driver.js / webpack.config.prod.js
kamrify's picture
Fix - Production build and update static files
1f3be9a
raw
history blame
1.26 kB
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
mode: 'production',
entry: [
'./src/driver.scss',
'./src/index.js',
],
output: {
path: path.join(__dirname, '/dist'),
publicPath: '/dist/',
filename: 'driver.min.js',
libraryTarget: 'umd',
library: 'Driver',
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
enforce: 'pre',
options: {
failOnWarning: false,
failOnError: true,
},
},
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['env'],
plugins: ['babel-plugin-add-module-exports'],
},
},
{
test: /.scss$/,
loader: ExtractTextPlugin.extract([
{
loader: 'css-loader',
options: { minimize: true, url: false },
},
'sass-loader',
]),
},
],
},
plugins: [
new ExtractTextPlugin({
filename: 'driver.min.css',
allChunks: true,
}),
],
stats: {
colors: true,
},
devtool: 'cheap-module-source-map',
};