ocrcc-chatbox/webpack.config.js
2018-05-28 22:49:38 -04:00

51 lines
1.2 KiB
JavaScript

const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const devMode = process.env.NODE_ENV !== 'production';
module.exports = {
mode: 'development',
plugins: [
new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename: devMode ? '[name].css' : '[name].[hash].css',
chunkFilename: devMode ? '[id].css' : '[id].[hash].css',
}),
],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.scss$/,
use: [
// fallback to style-loader in development
devMode ? 'style-loader' : MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader',
],
},
],
},
resolve: {
extensions: ['*', '.js', '.jsx'],
},
entry: [
'./src/index.js',
],
output: {
path: __dirname + '/dist',
publicPath: '/',
filename: 'embeddable-widget.js',
library: 'EmbeddableWidget',
libraryExport: 'default',
libraryTarget: 'window',
},
serve: {
content: ['./dist', './public'],
},
};