mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-10-31 03:52:13 +08:00
73 lines
1.6 KiB
JavaScript
73 lines
1.6 KiB
JavaScript
const path = require('path');
|
|
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
const OptimizeCssAssetsPlugin = require('optimize-css-assets-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',
|
|
libraryExport: 'default',
|
|
},
|
|
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',
|
|
},
|
|
{
|
|
test: /.scss$/,
|
|
loader: ExtractTextPlugin.extract([
|
|
{
|
|
loader: 'css-loader',
|
|
options: { url: false },
|
|
},
|
|
'sass-loader',
|
|
]),
|
|
},
|
|
],
|
|
},
|
|
plugins: [
|
|
new ExtractTextPlugin({
|
|
filename: 'driver.min.css',
|
|
allChunks: true,
|
|
}),
|
|
new OptimizeCssAssetsPlugin({
|
|
assetNameRegExp: /\.min\.css$/g,
|
|
// eslint-disable-next-line global-require
|
|
cssProcessor: require('cssnano'),
|
|
cssProcessorPluginOptions: {
|
|
preset: [
|
|
'default',
|
|
{
|
|
discardComments: { removeAll: true },
|
|
},
|
|
],
|
|
},
|
|
canPrint: true,
|
|
}),
|
|
],
|
|
stats: {
|
|
colors: true,
|
|
},
|
|
devtool: 'cheap-module-source-map',
|
|
};
|