vux使用最新版本2.6.4后启动报错

发布于 2022-09-06 02:17:23 字数 5841 浏览 21 评论 0

项目之前使用的是vux的2.5.12版本,在升级2.6.4后再npm run dev,后就开始报错,在官网上找不到相关的描述。

图片描述


D:\svnNew\Web_developer\Project\web\BlueButterfly>npm run dev

> y@1.0.0 dev D:\svnNew\Web_developer\Project\web\BlueButterfly
> node build/dev-server.js

> Starting dev server...


 ERROR  Failed to compile with 1 errors                                 10:54:50


 error  in ./~/_vux@2.6.4@vux/src/mixins/prevent-body-scroll.css

Module build failed: Unknown word (5:1)

  3 | // load the styles
  4 | var content = require("!!../../../_css-loader@0.28.7@css-loader/index.js?{
\"minimize\":false,\"sourceMap\":false}!./prevent-body-scroll.css");
> 5 | if(typeof content === 'string') content = [[module.id, content, '']];
    | ^
  6 | if(content.locals) module.exports = content.locals;
  7 | // add the styles to the DOM
  8 | var update = require("!../../../_vue-style-loader@3.0.1@vue-style-loader/l
ib/addStylesClient.js")("b9b010f2", content, false);


 @ ./~/_vux@2.6.4@vux/src/mixins/prevent-body-scroll.css 4:14-217 18:2-22:4 19:2
0-223
 @ ./~/_vux@2.6.4@vux/src/mixins/prevent-body-scroll.js
 @ ./~/_babel-loader@7.1.2@babel-loader/lib!./~/_vux-loader@1.1.15@vux-loader/sr
c/script-loader.js!./~/_vue-loader@12.2.2@vue-loader/lib/selector.js?type=script
&index=0!./~/_vux@2.6.4@vux/src/components/x-dialog/index.vue
 @ ./~/_vux@2.6.4@vux/src/components/x-dialog/index.vue
 @ ./~/_babel-loader@7.1.2@babel-loader/lib!./~/_vux-loader@1.1.15@vux-loader/sr
c/script-loader.js!./~/_vue-loader@12.2.2@vue-loader/lib/selector.js?type=script
&index=0!./src/components/DynamicPage.vue
 @ ./src/components/DynamicPage.vue
 @ ./src/router/index.js
 @ ./src/main.js
 @ multi ./build/dev-client ./src/main.js

附上webpack.base.conf.js和package.json配置

var path = require('path')
var utils = require('./utils')
var config = require('../config')
var vueLoaderConfig = require('./vue-loader.conf')

function resolve (dir) {
  return path.join(__dirname, '..', dir)
}




const webpackConfig = {

  entry: {
    app: './src/main.js'
  },
  output: {
    path: config.build.assetsRoot,
    filename: '[name].js',
    //手机App
    //  publicPath: "./"
    publicPath: process.env.NODE_ENV === 'production'
      ? config.build.assetsPublicPath
      : config.dev.assetsPublicPath
  },
  resolve: {
    extensions: ['.js', '.vue', '.json'],
    alias: {
      'vue$': 'vue/dist/vue.esm.js',
      '@': resolve('src')
    }
  },
  module: {
    rules: [
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: vueLoaderConfig
      },
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [resolve('src'), resolve('test')]
      },
      {
        test: /\.css$/,
        include: [
          /src/
        ],
        loader: 'style-loader!css-loader'
      },
      {
        test: /\.less$/,
        loader: 'less-loader'
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('media/[name].[hash:7].[ext]')
        }
      },
      {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
        }
      }
    ]
  }
}
const vuxLoader = require('vux-loader')
module.exports = vuxLoader.merge(webpackConfig, {
  plugins: ['vux-ui']
})
{
  "name": "y",
  "version": "1.0.0",
  "description": "y",
  "author": "",
  "private": true,
  "scripts": {
    "dev": "node build/dev-server.js",
    "start": "node build/dev-server.js",
    "build": "node build/build.js"
  },
  "dependencies": {
    "css-loader": "^0.28.5",
    "mint-ui": "^2.2.9",
    "vue": "^2.3.3",
    "vue-quill-editor": "^2.3.2",
    "vue-router": "^2.7.0",
    "vuex": "^2.3.1",
    "vux": "^2.6.4"
  },
  "devDependencies": {
    "autoprefixer": "^7.1.2",
    "babel-core": "^6.22.1",
    "babel-loader": "^7.1.1",
    "babel-plugin-component": "^0.10.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-preset-env": "^1.3.2",
    "babel-preset-stage-2": "^6.22.0",
    "babel-register": "^6.22.0",
    "chalk": "^2.0.1",
    "connect-history-api-fallback": "^1.3.0",
    "copy-webpack-plugin": "^4.0.1",
    "css-loader": "^0.28.4",
    "cssnano": "^3.10.0",
    "eventsource-polyfill": "^0.9.6",
    "express": "^4.14.1",
    "extract-text-webpack-plugin": "^2.0.0",
    "file-loader": "^0.11.1",
    "friendly-errors-webpack-plugin": "^1.1.3",
    "html-webpack-plugin": "^2.28.0",
    "http-proxy-middleware": "^0.17.3",
    "install": "^0.10.1",
    "less": "^2.7.2",
    "less-loader": "^4.0.5",
    "node-sass": "^4.5.3",
    "opn": "^5.1.0",
    "optimize-css-assets-webpack-plugin": "^2.0.0",
    "ora": "^1.2.0",
    "rimraf": "^2.6.0",
    "sass-loader": "^6.0.6",
    "semver": "^5.3.0",
    "shelljs": "^0.7.6",
    "style-loader": "^0.18.2",
    "url-loader": "^0.5.8",
    "vue-loader": "^12.1.0",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.3.3",
    "vux-loader": "^1.1.15",
    "webpack": "^2.6.1",
    "webpack-bundle-analyzer": "^2.2.1",
    "webpack-dev-middleware": "^1.10.0",
    "webpack-hot-middleware": "^2.18.0",
    "webpack-merge": "^4.1.0"
  },
  "engines": {
    "node": ">= 4.0.0",
    "npm": ">= 3.0.0"
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not ie <= 8"
  ]
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

水晶透心 2022-09-13 02:17:23
// 可能是因为这里加了include,导致require node_modules 里的css文件的时候没有触发这里的loader
{
        test: /\.css$/,
        include: [
          /src/
        ],
        loader: 'style-loader!css-loader'
      },
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文