cookiecutter-django/{{cookiecutter.project_slug}}/webpack/common.config.js
Bruno Alla 0dcc4c4b4c
Add more pre-commit hooks (#4266)
* Add more hooks from pre-commit-hooks repo

* Add pre-commit hook for prettier

* Format with prettier

* Remove check-docstring-first hook

* Run prettier in the template

* Tweak formatting of dependabot file

* Fix formatting of GitHub files for prettier

* More format fixes of ci.yml
2023-04-15 12:15:15 +01:00

57 lines
1.5 KiB
JavaScript

const path = require('path');
const BundleTracker = require('webpack-bundle-tracker');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
target: 'web',
context: path.join(__dirname, '../'),
entry: {
project: path.resolve(__dirname, '../{{cookiecutter.project_slug}}/static/js/project'),
vendors: path.resolve(__dirname, '../{{cookiecutter.project_slug}}/static/js/vendors'),
},
output: {
path: path.resolve(
__dirname,
'../{{cookiecutter.project_slug}}/static/webpack_bundles/',
),
publicPath: '/static/webpack_bundles/',
filename: 'js/[name]-[fullhash].js',
chunkFilename: 'js/[name]-[hash].js',
},
plugins: [
new BundleTracker({
filename: path.resolve(__dirname, '../webpack-stats.json'),
}),
new MiniCssExtractPlugin({ filename: 'css/[name].[contenthash].css' }),
],
module: {
rules: [
// we pass the output from babel loader to react-hot loader
{
test: /\.js$/,
loader: 'babel-loader',
},
{
test: /\.s?css$/i,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
{
loader: 'postcss-loader',
options: {
postcssOptions: {
plugins: ['postcss-preset-env', 'autoprefixer', 'pixrem'],
},
},
},
'sass-loader',
],
},
],
},
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx'],
},
};