在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/HTML/ weex對es6語法報(bào)錯(cuò),...

weex對es6語法報(bào)錯(cuò),...

根據(jù)官網(wǎng),進(jìn)行weex的初始化安裝,最后啟動(dòng)的時(shí)候,報(bào)錯(cuò)

H:\workspace\webstorm\weex-t>npm start

> weex-t@1.0.0 start H:\workspace\webstorm\weex-t
> npm run serve


> weex-t@1.0.0 serve H:\workspace\webstorm\weex-t
> webpack-dev-server --env.NODE_ENV=development --progress

H:\workspace\webstorm\weex-t\configs\webpack.common.conf.js:95
    ...webEntry,
    ^^^
SyntaxError: Unexpected token ...
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (H:\workspace\webstorm\weex-t\configs\webpack.dev.conf.js:1:84)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! weex-t@1.0.0 serve: `webpack-dev-server --env.NODE_ENV=development --progress`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the weex-t@1.0.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\thinklight\AppData\Roaming\npm-cache\_logs\2018-02-27T08_33_16_191Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! weex-t@1.0.0 start: `npm run serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the weex-t@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\thinklight\AppData\Roaming\npm-cache\_logs\2018-02-27T08_33_16_239Z-debug.log

是對webpack.common.conf.js中的...報(bào)語法錯(cuò)誤,這個(gè)是官方默認(rèn)的初始化代碼,要怎么解決呢

const webConfig = {
  entry: {
    ...webEntry,
    'vendor': [path.resolve('node_modules/phantom-limb/index.js')]
  },
  output: {
    path: helper.rootNode('./dist'),
    filename: '[name].web.js'
  },
  // 省略若干
}
回答
編輯回答
巴扎嘿

@我在等風(fēng)也等你
需要用到Babel轉(zhuǎn)碼

    # 最新轉(zhuǎn)碼規(guī)則
    $ npm install --save-dev-g babel-preset-es2015

    # react 轉(zhuǎn)碼規(guī)則
    $ npm install --save-dev-g babel-preset-react

    # 不同階段語法提案的轉(zhuǎn)碼規(guī)則(共有4個(gè)階段),選裝一個(gè)
    $ npm install --save-dev babel-preset-stage-0
    $ npm install --save-dev babel-preset-stage-1
    $ npm install --save-dev babel-preset-stage-2
    $ npm install --save-dev babel-preset-stage-3
    然后,將這些規(guī)則加入.babelrc
      {
            "presets": [
            "es2015",
            "react",
            "stage-2"
            ],
            "plugins": []
        }
    #babel-cli工具
    $ npm install --global babel-cli

在進(jìn)行weex的初始化

    weex create weex-xx

新建的工程的js語法都沒問題了
舊代碼

entry: {
    ...webEntry,
    'vendor': [path.resolve('node_modules/phantom-limb/index.js')]
  },

新代碼

  entry: Object.assign(webEntry, {
    'vendor': [path.resolve('node_modules/phantom-limb/index.js')]
  }),
2018年6月13日 00:58
編輯回答
誮惜顏

ES6暫時(shí)只能展開數(shù)組,以及把偽數(shù)組(特殊對象)展開為對象.

2018年5月30日 20:20
編輯回答
伴謊

請問你解決了嗎 我也遇到這個(gè)問題了

2018年2月24日 11:01