Merge branch 'chore/env-assets-path' into 'master'

Configure assets public path per env

See merge request pleroma/admin-fe!13
This commit is contained in:
feld 2019-05-07 17:05:23 +00:00
commit 6fdbd444be
5 changed files with 11 additions and 7 deletions

View file

@ -16,6 +16,8 @@ function resolve(dir) {
const HOST = process.env.HOST
const PORT = process.env.PORT && Number(process.env.PORT)
const devEnv = require('../config/dev.env')
const devWebpackConfig = merge(baseWebpackConfig, {
mode: 'development',
module: {
@ -39,7 +41,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
overlay: config.dev.errorOverlay
? { warnings: false, errors: true }
: false,
publicPath: config.dev.assetsPublicPath,
publicPath: devEnv.ASSETS_PUBLIC_PATH,
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
@ -59,7 +61,7 @@ const devWebpackConfig = merge(baseWebpackConfig, {
favicon: resolve('favicon.ico'),
title: 'Admin FE',
templateParameters: {
BASE_URL: config.dev.assetsPublicPath + config.dev.assetsSubDirectory,
BASE_URL: devEnv.ASSETS_PUBLIC_PATH + config.dev.assetsSubDirectory,
},
}),
]

View file

@ -57,7 +57,7 @@ const webpackConfig = merge(baseWebpackConfig, {
favicon: resolve('favicon.ico'),
title: 'Admin FE',
templateParameters: {
BASE_URL: config.build.assetsPublicPath + config.build.assetsSubDirectory,
BASE_URL: env.ASSETS_PUBLIC_PATH + config.build.assetsSubDirectory,
},
minify: {
removeComments: true,

View file

@ -1,4 +1,5 @@
module.exports = {
NODE_ENV: '"development"',
ENV_CONFIG: '"dev"'
ENV_CONFIG: '"dev"',
ASSETS_PUBLIC_PATH: '/'
}

View file

@ -8,7 +8,7 @@ module.exports = {
dev: {
// Paths
assetsSubDirectory: 'static',
assetsPublicPath: '/',
// assetsPublicPath: '', // To configure assetsPublicPath set ASSETS_PUBLIC_PATH in dev/prod.env.js
proxyTable: {},
// Various Dev Server settings
@ -60,7 +60,7 @@ module.exports = {
* then assetsPublicPath should be set to "/bar/".
* In most cases please use '/' !!!
*/
assetsPublicPath: '/',
// assetsPublicPath: '', // To configure assetsPublicPath set ASSETS_PUBLIC_PATH in dev/prod.env.js
/**
* Source Maps

View file

@ -1,5 +1,6 @@
module.exports = {
NODE_ENV: '"production"',
ENV_CONFIG: '"prod"',
BASE_API: '"https://api-prod"'
BASE_API: '"https://api-prod"',
ASSETS_PUBLIC_PATH: '/pleroma/admin/'
}