为了账号安全,请及时绑定邮箱和手机立即绑定

index.mpx

只要添加上这句话     import store from '../store/index.js'


就报错 :

Hash: 2a69cb49eb697feb2623

Version: webpack 4.46.0

Time: 472ms

Built at: 01/19/2021 3:25:52 PM

             Asset      Size  Chunks                          Chunk Names

            app.js  56.6 KiB       0  [emitted]               app

        app.js.map  57.4 KiB       0  [emitted] [dev]         app

          app.json  38 bytes          [emitted]               

         bundle.js   520 KiB       1  [emitted]        [big]  bundle

     bundle.js.map   576 KiB       1  [emitted] [dev]         bundle

    pages/index.js  2.39 KiB       2  [emitted]               pages/index

pages/index.js.map  2.66 KiB       2  [emitted] [dev]         pages/index

  pages/index.json  27 bytes          [emitted]               

  pages/index.wxml  63 bytes          [emitted]               


ERROR in ./src/pages/index.mpx?isFirst=true

Module Error (from ./node_modules/eslint-loader/index.js):


/Users/zhangwei/Desktop/小程序/mpx-demo/src/pages/index.mpx

  8:10  error  'store' is defined but never used  no-unused-vars


✖ 1 problem (1 error, 0 warnings)



ERROR in ./src/store/index.js

Module Error (from ./node_modules/eslint-loader/index.js):


/Users/zhangwei/Desktop/小程序/mpx-demo/src/store/index.js

  1:8   error  A space is required after '{'   object-curly-spacing

  1:20  error  A space is required before '}'  object-curly-spacing


✖ 2 problems (2 errors, 0 warnings)

  2 errors and 0 warnings potentially fixable with the `--fix` option.


 @ ./src/pages/index.mpx?isFirst=true (./node_modules/babel-loader/lib!./node_modules/@mpxjs/webpack-plugin/lib/selector.js?{"type":"script","index":0}!./src/pages/index.mpx?isFirst=true) 2:0-38

 @ ./src/pages/index.mpx?isFirst=true


  Build failed with errors.

但是小程序那边可以运行



正在回答

1 回答

你好,这些报错都是eslint报的,不符合eslint规则,第一个是说你引入的store没有使用,第二个就是说你应该在左大括号后和右大括号前各留一下空格。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
零基础入门 mpx 小程序框架
  • 参与学习       11726    人
  • 解答问题       21    个

增强型小程序框架Mpx使用入门教程

进入课程
意见反馈 帮助中心 APP下载
官方微信