vue.config.js 648 B

123456789101112131415161718192021222324252627
  1. const TransformPages = require('uni-read-pages')
  2. const ScriptSetup = require('unplugin-vue2-script-setup/webpack').default;
  3. const {
  4. webpack
  5. } = new TransformPages()
  6. module.exports = {
  7. configureWebpack: {
  8. plugins: [
  9. new webpack.DefinePlugin({
  10. ROUTES: webpack.DefinePlugin.runtimeValue(() => {
  11. const tfPages = new TransformPages({
  12. includes: ['path', 'name', 'aliasPath', 'meta']
  13. });
  14. return JSON.stringify(tfPages.routes)
  15. }, true)
  16. }),
  17. ScriptSetup({
  18. /* options */
  19. }),
  20. ]
  21. },
  22. chainWebpack(config) {
  23. // disable type check and let `vue-tsc` handles it
  24. config.plugins.delete('fork-ts-checker');
  25. },
  26. }