cookiecutter-django/{{cookiecutter.project_slug}}/webpack/prod.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

29 lines
1.0 KiB
JavaScript

const { merge } = require('webpack-merge');
const commonConfig = require('./common.config');
// This variable should mirror the one from config/settings/production.py
{%- if cookiecutter.use_whitenoise == 'n' %}
{%- if cookiecutter.cloud_provider == 'AWS' %}
const s3BucketName = process.env.DJANGO_AWS_STORAGE_BUCKET_NAME;
const awsS3Domain = process.env.DJANGO_AWS_S3_CUSTOM_DOMAIN
? process.env.DJANGO_AWS_S3_CUSTOM_DOMAIN
: `${s3BucketName}.s3.amazonaws.com`;
const staticUrl = `https://${awsS3Domain}/static/`;
{%- elif cookiecutter.cloud_provider == 'GCP' %}
const staticUrl = `https://storage.googleapis.com/${process.env.DJANGO_GCP_STORAGE_BUCKET_NAME}/static/`;
{%- elif cookiecutter.cloud_provider == 'Azure' %}
const staticUrl = `https://${process.env.DJANGO_AZURE_ACCOUNT_NAME}.blob.core.windows.net/static/`;
{%- endif %}
{%- else %}
const staticUrl = '/static/';
{%- endif %}
module.exports = merge(commonConfig, {
mode: 'production',
devtool: 'source-map',
bail: true,
output: {
publicPath: `${staticUrl}webpack_bundles/`,
},
});