Created
March 12, 2023 12:44
-
-
Save BoDonkey/fd6369e272c176a4dd7b3288bda66e0f to your computer and use it in GitHub Desktop.
Webpack options to use vue2 front-end components in ApostropheCMS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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