Skip to content

Instantly share code, notes, and snippets.

@BoDonkey
Created March 12, 2023 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BoDonkey/fd6369e272c176a4dd7b3288bda66e0f to your computer and use it in GitHub Desktop.
Save BoDonkey/fd6369e272c176a4dd7b3288bda66e0f to your computer and use it in GitHub Desktop.
Webpack options to use vue2 front-end components in ApostropheCMS
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const path = require('path');
module.exports = {
// When not in production, refresh the page on restart
options: {
refreshOnRestart: true
},
webpack: {
extensions: {
addVue: {
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader',
options: {
sourceMap: true
}
}
]
},
plugins: [
// make sure to include the plugin for the magic
new VueLoaderPlugin()
],
resolveLoader: {
extensions: [ '.vue' ]
},
resolve: {
extensions: [ '.vue' ],
alias: {
vue$: 'vue/dist/vue.runtime.esm.js',
// This alias can be pointed where you want
// Or you can choose to have component files in your module
// `ui/src` folders
Components: path.join(process.cwd(), 'lib/components')
}
}
}
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment