A-Toasty-OWA/config/webpack.common.js
2024-09-02 16:18:40 +02:00

59 lines
1.3 KiB
JavaScript

'use strict';
const SizePlugin = require('size-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const PATHS = require('./paths');
const { ProvidePlugin } = require('webpack');
// To re-use webpack configuration across templates,
// CLI maintains a common webpack configuration file - `webpack.common.js`.
// Whenever user creates an extension, CLI adds `webpack.common.js` file
// in template's `config` folder
const common = {
output: {
// the build folder to output bundles and assets in.
path: PATHS.build,
// the filename template for entry chunks
filename: '[name].js',
},
devtool: 'source-map',
stats: {
all: false,
errors: true,
builtAt: true,
},
module: {
rules: [
// Check for images imported in .js files and
{
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: 'file-loader',
options: {
outputPath: 'images',
name: '[name].[ext]',
},
},
],
},
],
},
plugins: [
// Print file sizes
new SizePlugin(),
// Copy static assets from `public` folder to `build` folder
new CopyWebpackPlugin({
patterns: [
{
from: '**/*',
context: 'public',
},
]
}),
],
};
module.exports = common;