Skip to content

Commit

Permalink
fix(vue-cli): fix public folder and index template for vue-cli
Browse files Browse the repository at this point in the history
Vue cli expects root public folder. Fix plugins in vue config to fix that
  • Loading branch information
travis-w committed Feb 27, 2020
1 parent e8c0c00 commit 5796cb8
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions vue.config.js
@@ -1,10 +1,11 @@
const path = require('path');
const path = require('path')
const CopyPlugin = require('copy-webpack-plugin')

const isProd = process.env.NODE_ENV === 'production'

module.exports = {
publicPath: '/hijacker/',
outputDir: 'lib/frontend',
outputDir: './lib/frontend',
chainWebpack: config => {
config
.entry('app')
Expand All @@ -23,5 +24,32 @@ module.exports = {
SOCKET_HOST: isProd ? '' : JSON.stringify('http://localhost:3000')
}]
})

// Fix html template plugin
config
.plugin('html')
.tap(args => {
return [{
...args[0],
template: './src/frontend/public/index.html'
}]
})

// Move Public Folder
config
.plugin('copy')
.use(CopyPlugin, [
[{
from: './src/frontend/public',
toType: 'dir',
ignore: [
'.DS_Store',
{
glob: 'index.html',
matchBase: false
}
]
}]
])
}
};
}

0 comments on commit 5796cb8

Please sign in to comment.