apache / incubator-weex-loader

Apache License 2.0
65 stars 32 forks source link

Cannot resolve module 'weex-loader/node_modules/weex-vue-loader/lib/template-compiler' #39

Closed WalterZou closed 7 years ago

WalterZou commented 7 years ago

When I ran npm run build with weex-hackernews, it threw this error : image

Actually, tha path weex-loader/node_modules/ didn't exist

ianchenyangzhao commented 7 years ago
var IS_TEST = !!process.env.VUE_LOADER_TEST
var fs = require('fs')
var path = require('path')

var hasWeexLoader = false
try {
  hasWeexLoader = !!require('weex-loader')
} catch (e) {}

exports.lib = function (file) {
  if (hasWeexLoader) {
    return 'weex-loader/node_modules/weex-vue-loader/lib/' + file
  }
  if (IS_TEST) {
    return path.resolve(__dirname, file)
  } else {
    return 'weex-vue-loader/lib/' + file
  }
}

exports.dep = function (dep) {
  if (hasWeexLoader) {
    return 'weex-loader/node_modules/weex-vue-loader/node_modules/' + dep
  }
  if (IS_TEST) {
    return dep
  } else if (fs.existsSync(path.resolve(__dirname, '../node_modules', dep))) {
    // npm 2 or npm linked
    return 'weex-vue-loader/node_modules/' + dep
  } else {
    // npm 3
    return dep
  }
}

seems like hasWeexLoader might not be needed for weex-loader@0.4.1? same issue was reported here: https://github.com/weexteam/weex-hackernews/issues/4

Jinjiang commented 7 years ago

fixed in weex-vue-loader@0.2.4on which weex-loader depends. please re-install weex-loader. thanks.