简体   繁体   English

vue.config.js 似乎没有加载

[英]vue.config.js does not seem to load

In:在:

https://codesandbox.io/s/dazzling-jepsen-r7283?file=/vue.config.js https://codesandbox.io/s/dazzling-jepsen-r7283?file=/vue.config.js

based on:基于:

https://stackoverflow.com/a/68308416/1079483 https://stackoverflow.com/a/68308416/1079483

vue.config.js

const path = require("path");
module.exports = {
  configureWebpack: {
    resolve: {
      alias: {
        "modal-styles": path.resolve(__dirname, "./src/styles/modal-style.css")
      }
    }
  },
  css: {
    loaderOptions: {
      less: {
        modifyVars: {},
        javascriptEnabled: true
      }
    }
  }
};

is not loaded by vue-cli.不是由 vue-cli 加载的。 The idea is to replicate:这个想法是复制:

https://codesandbox.io/s/cs-vue-cli-3-vj2rl?file=/vue.config.js https://codesandbox.io/s/cs-vue-cli-3-vj2rl?file=/vue.config.js

When reaching the styles tag of EditCategory.vue :当到达EditCategory.vuestyles标签时:

<style scoped>
@import 'modal-styles';
</style>

the alias cannot be read:无法读取别名:

TypeError
Path must be a string. Received null
r
https://codesandbox.io/static/js/common-sandbox.7be24d846.chunk.js:1:246770
Object.isAbsolute
https://codesandbox.io/static/js/common-sandbox.7be24d846.chunk.js:1:247916
(anonymous function)
https://codesandbox.io/static/js/vendors~postcss-compiler~vue-style-compiler.f9e51cefa.chunk.js:1:1069
(anonymous function)
https://codesandbox.io/static/js/vendors~postcss-compiler~vue-style-compiler.f9e51cefa.chunk.js:1:1060
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
This error overlay is powered by `react-error-overlay` used in `create-react-app`.

The path was wrong in style :路径style错误:

<style>
  @import '/src/styles/modal-style.css';
</style>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM