webpack配置scss有错误: this.getOptions is not a function

leon
  • 2
新手上路,请多包涵

已经安装了node-sass和sass-loader
如: "devDependencies": {

"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"node-sass": "^6.0.0",
"sass-loader": "^12.0.0",
"vue-template-compiler": "^2.6.11"

},
但是在webpack配置scss有错误: error in ./src/App.vue?vue&type=style&index=0&id=7ba5bd90&scoped=true&lang=scss& Syntax Error: TypeError: this.getOptions is not a function

另外我自己百度的vue.config.js配置成这样:
module.exports = {

// 基本路径
publicPath: '/',
// 输出文件目录
outputDir: 'dist',
// eslint-loader 是否在保存的时候检查
lintOnSave: false,
// use the full build with in-browser compiler?
// https://vuejs.org/v2/guide/installation.html#Runtime-Compiler-vs-Runtime-only
runtimeCompiler: false,
// webpack配置
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
chainWebpack: () => {},
configureWebpack: () => {},
// vue-loader 配置项
// https://vue-loader.vuejs.org/en/options.html
// vueLoader: {},
// 生产环境是否生成 sourceMap 文件
productionSourceMap: false,
// css相关配置
/*css: {
    // 是否使用css分离插件 ExtractTextPlugin
    extract: true,
    // 开启 CSS source maps?
    sourceMap: false,
    // css预设器配置项
    loaderOptions: {},
    // 启用 CSS modules for all css / pre-processor files.
    modules: false
},*/
// use thread-loader for babel & TS in production build
// enabled by default if the machine has more than 1 cores
parallel: require('os').cpus().length > 1,
// 是否启用dll
// See https://github.com/vuejs/vue-cli/blob/dev/docs/cli-service.md#dll-mode
// dll: false,
// PWA 插件相关配置
// see https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-pwa
pwa: {},
// webpack-dev-server 相关配置
devServer: {
    // open: process.platform === 'darwin',
    //将服务启动后默认打开浏览器
    open: true,
    host: '0.0.0.0',
    port: 8080,
    https: false,
    hotOnly: false,
    proxy: {// 设置代理
        '/api': {
            target: 'http://www.lzzyaf.com',
            changeOrigin: true,
            pathRewrite: {
                '^/api': '/'
            }
        }
    },
    before: app => {}
},
// 第三方插件配置
pluginOptions: {
    // ...
}

}

这个错误是什么原因呢?

回复
阅读 1.2k
1 个回答
✓ 已被采纳
你知道吗?

宣传栏