Skip to content
This repository has been archived by the owner on Jul 16, 2022. It is now read-only.

Commit

Permalink
feat(vue-cli): Add profile option for baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Sep 10, 2018
1 parent 062fa13 commit a640ca4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion packages/cli-plugin-vue/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ module.exports = config => {
config.resolve({
outputDir: '<themesDir>/<currentWebsite>',
scssMixinsPath: '',
baseUrl: '/',
baseUrl: {
production: '/themes/<currentWebsite>',
development: '/'
},
entries: [
{
mode: 'production',
Expand Down
12 changes: 10 additions & 2 deletions packages/cli-plugin-vue/src/webpack/build.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable global-require */
/* eslint-disable global-require,prefer-destructuring */
const path = require('path');
const fs = require('fs-extra');
const resetWebpackConfig = require('./reset');
Expand All @@ -7,7 +7,7 @@ const buildWebpackAlias = require('./alias');
const buildWebpackAssets = require('./assets');

module.exports = (config, baseVueConfig) => {
const { scssMixinsPath, baseUrl, outputDir = config.currentWebsiteDir } = config.vueCli;
const { scssMixinsPath, outputDir = config.currentWebsiteDir } = config.vueCli;
let sass = {};

if (fs.existsSync(scssMixinsPath)) {
Expand All @@ -17,6 +17,14 @@ module.exports = (config, baseVueConfig) => {
};
}

let baseUrl;

if (config.vueCli.baseUrl === 'string') {
baseUrl = config.vueCli.baseUrl;
} else {
baseUrl = process.env.NODE_ENV === 'production' ? baseUrl.production : baseUrl.development;
}

const vueConfig = {
...baseVueConfig,
baseUrl,
Expand Down

0 comments on commit a640ca4

Please sign in to comment.