Open OneWolfgang opened 5 years ago
下载项目后,运行报如下错误: error in ./src/pages/index/main.js Module build failed: Error: [mpvue-loader] need "fileExt" option in file "build/vue-loader.conf.js",init a new project and copy the directory "build/" to this porject, or just check the "fileExt" option at Object.module.exports (D:\JS\MPVUE\mpvue-meituan-master\node_modules_mpvue-loader@1.4.0@mpvue-loader\lib\loader.js:55:11)
package.json: { "mpvue": "^1.0.11", "mpvue-loader": "^1.1.2", "mpvue-template-compiler": "^1.0.11" } => { "mpvue": "1.0.11", "mpvue-loader": "1.1.2", "mpvue-template-compiler": "1.0.11" }
编译成功了,但是没有生成app.json
增加一个fileExt选项即可。
var fileExt = fileExtConfig["wx"] // process.env.PLATFORM module.exports = { // 如果要自定义生成的 dist 目录里面的文件路径, // 可以将 entry 写成 {'toPath': 'fromPath'} 的形式, // toPath 为相对于 dist 的路径, 例:index/demo,则生成的文件地址为 dist/index/demo.js entry, target: require('mpvue-webpack-target'), output: { path: config.build.assetsRoot, filename: '[name].js', publicPath: process.env.NODE_ENV === 'production' ? config.build.assetsPublicPath : config.dev.assetsPublicPath }, resolve: { extensions: ['.js', '.vue', '.json'], alias: { 'vue': 'mpvue', '@': resolve('src') }, symlinks: false, aliasFields: ['mpvue', 'weapp', 'browser'], mainFields: ['browser', 'module', 'main'] }, module: { rules: [ { test: /.vue$/, loader: 'mpvue-loader', options: vueLoaderConfig }, { test: /.js$/, include: [resolve('src'), resolve('test')], use: [ 'babel-loader', { loader: 'mpvue-loader', options: { fileExt:fileExt, checkMPEntry: true } }, ] }, { test: /.(png|jpe?g|gif|svg)(\?.)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('img/[name].[ext]') } }, { test: /.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('media/[name].[ext]') } }, { test: /.(woff2?|eot|ttf|otf)(\?.*)?$/, loader: 'url-loader', options: { limit: 10000, name: utils.assetsPath('fonts/[name].[ext]') } } ] }, plugins: [ new MpvuePlugin() ] }
@OneWolfgang @jerecui @guangqiang-liu
解决方案: https://github.com/Meituan-Dianping/mpvue/releases/tag/2.0.0
我测试的是:用npm install就可以,但是用yarn install就不行,shit~
怎么没有 app.json 文件了?
下载项目后,运行报如下错误: error in ./src/pages/index/main.js Module build failed: Error: [mpvue-loader] need "fileExt" option in file "build/vue-loader.conf.js",init a new project and copy the directory "build/" to this porject, or just check the "fileExt" option at Object.module.exports (D:\JS\MPVUE\mpvue-meituan-master\node_modules_mpvue-loader@1.4.0@mpvue-loader\lib\loader.js:55:11)