weexteam / hackernews-App-powered-by-Apache-Weex

1.15k stars 226 forks source link

npm run build报错 #4

Closed lwfyiwei closed 7 years ago

lwfyiwei commented 7 years ago

image

yjj5855 commented 7 years ago

一样 weex-loader 这个包不对

alwayrun commented 7 years ago

@Hanks10100 @Jinjiang

├── babel-core@6.21.0
├── babel-loader@6.2.10
├── babel-plugin-transform-runtime@6.15.0
├── babel-preset-es2015@6.18.0
├── babel-runtime@6.20.0
├── css-loader@0.26.1
├── serve@1.4.0
├── vue@2.1.6
├── vue-loader@10.0.2
├── vue-router@2.1.1
├── vue-template-compiler@2.1.6
├── vuex@2.1.1
├── vuex-router-sync@4.0.2
├── webpack@1.14.0
├── weex-loader@0.4.0
└── weex-vue-render@0.1.0-beta.2

npm run build:weex

alwayrun commented 7 years ago

@yjj5855 @lwfyiwei 你们这个问题解决了吗?

alwayrun commented 7 years ago
我在 node 4.0.0 上执行 npm run build:week 是没问题,估计是在高版本的node上npm扁平之后的原因
yjj5855 commented 7 years ago

@alwayrun node 6 npm 3

WalterZou commented 7 years ago

同样有这个问题...

gary149 commented 7 years ago

solution anyone ?

Jinjiang commented 7 years ago

我看一下

ianchenyangzhao commented 7 years ago

和这个issue是一样的。 https://github.com/weexteam/weex-loader/issues/39 我目前是 node v7.2.9 npm v3.10.9

ianchenyangzhao commented 7 years ago

@Jinjiang 我对webpack.weex.config.js做了些修改,在载入`weex-loader之前,载入vue-loader`对Vue文件进行编译,然后整个编译就顺利通过了。

  module: {
    loaders: [
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/
      }, {
        test: /\.vue(\?[^?]+)?$/,
        loaders: ['weex-loader']
      }, {
        test: /\.vue(\?[^?]+)?$/,
        loaders: ['vue-loader']
      }
    ]
  }
ianchenyangzhao commented 7 years ago

But I think we still need to update webpack config files. The output index.weex.js uses Vue instance, when copied to ios/assets and build on device will throw exception ReferenceError: Can't find variable: Vue. I'm using weex-loader@0.4.1

Hanks10100 commented 7 years ago

Sorry about the confusions. This app is under development, the code in master branch may not always new. It's my fault.

The webpack config works well in my env. I will check the compatibility of weex-loader. Although weex-loader support to compile .vue files, but the weex-vue-loader should also be installed.

randomradio commented 7 years ago

Thank you for all the hard work @Hanks10100. I'll update my env and add weex-vue-loader to the loader modules. See if this helps.

Jinjiang commented 7 years ago

It seems work well in latest master commit

WalterZou commented 7 years ago

@Jinjiang Well, pulled the lastest code just now, it seems still has this problem. image My dev environment:

Window 10
Node v7.3.0
NPM 4.0.5
PymZoR commented 7 years ago

Exact same problem as @WalterZou here. Environment:

macOS 10.12 Node v7.3.0
npm 4.0.5

PymZoR commented 7 years ago

I guess vue-weex-loader still needs to be added in the webpack config loaders: ['weex-loader', 'weex-vue-loader'] With this, it builds perfectly on my setup

Hanks10100 commented 7 years ago

@PymZoR It should works well with only weex-loader, and I can't trigger that error on my env (node v6.6.0).

I have tried to add weex-vue-loader in webpack config, but the bundle it generated is not correct.

Maybe some dependencies is missing in weex-loader, I will figure out the reason of this bizarre behavior.

Jinjiang commented 7 years ago

I have make a update for weex-vue-loader. And now we don't need to write it into devDeps directly because weex-loader depends on it. It works well for me at this time. Thanks.