mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-23 01:57:03 +03:00
cbb0e19de7
* Add support for Webpack as frontend pipeline * Rename CI jobs * Fix a couple of issues with Webpack + Docker * Don't include Boostrap CSS from CDN with Webpack * Rename variable * Set publicPath in prod webpack config * Fix removal of SASS files in post-gen hooks * Add Webpack to readme usage section * Run Django + Webpack dev server concurrently without Docker * Fix async runserver command with Gulp/Webpack * Upgrade django-webpack-loader to 1.5.0 * Pass variables required by Webpack at build time * Upgrade django-webpack-loader to 1.7.0 * Add missing condition * Add support for Azure Storage + Webpack * Whitespaces * Rename ROOT_DIR -> BASE_DIR * Rename jobs * Bump django-webpack-loader to latest * Document limitation of Docker + Webpack + no Whitenoise * Update section on custom Bootstrap compilation in generated readme
29 lines
1.0 KiB
JavaScript
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/`,
|
|
},
|
|
});
|