camedit
Version:
Small JS image editor wrapped around cropperjs
67 lines (40 loc) • 1.27 kB
JavaScript
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const webpack = require("webpack");
const inProduction = (process.env.NODE_ENV === "production");
module.exports = {
entry: ["babel-polyfill", "./src/js/app.js"],
output: {
filename: "camedit.min.js",
path: path.resolve(__dirname, "./src/dist")
},
optimization: {
minimize: inProduction
},
plugins: [
new MiniCssExtractPlugin({
filename: "camedit.min.css",
chunkFilename: "[id].css"
}),
new webpack.LoaderOptionsPlugin({
minimize: inProduction
})
],
module: {
rules: [
{ // CSS LOADERS
test: /\.s[ac]ss$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader", // Enables CSS but doesn't apply (option: style-loader)
"sass-loader" // Applies
]
},
{
test: (inProduction ? /\.js$/ : undefined),
exclude: (inProduction ? /node_modules/ : undefined),
loader: (inProduction ? "babel-loader" : undefined),
}
]
}
};