Skip to content
This repository has been archived by the owner on Aug 15, 2018. It is now read-only.

升级到3.6之后build出现错误 #1278

Closed
zvrr opened this issue Apr 28, 2015 · 7 comments
Closed

升级到3.6之后build出现错误 #1278

zvrr opened this issue Apr 28, 2015 · 7 comments

Comments

@zvrr
Copy link

zvrr commented Apr 28, 2015

你好,spm在另外一台机器上升级到最新版本v3.6.0之后,编译出现这样的错误。
image

请问这个要怎么解决?
之前运行的版本是v3.4.2. 感谢感谢!

@sorrycc
Copy link
Member

sorrycc commented Apr 28, 2015

不能 require output 中指定的文件。

@zvrr
Copy link
Author

zvrr commented Apr 28, 2015

build 详细信息是这样的。
WARNING in ttyd/0.0.1/exposure.click.js from UglifyJs
Dropping unused variable that [ttyd/0.0.1/exposure.click.js:92,13]
Condition always true [ttyd/0.0.1/exposure.click.js:9309,6]

ERROR in ./exposure.click.js
Module not found: Error: a dependency to an entry point is not allowed
@ ./exposure.click.js 6:11-31

ERROR in ./report.js
Module not found: Error: a dependency to an entry point is not allowed
@ ./report.js 6:11-31

ERROR in ./ttyd.js
Module not found: Error: a dependency to an entry point is not allowed
@ ./ttyd.js 1:13-35
error: Module not found: Error: a dependency to an entry point is not allowed
error: Module not found: Error: a dependency to an entry point is not allowed
error: Module not found: Error: a dependency to an entry point is not allowed

比如我在report.js 中有这样的require
var util = require('./util.js');
var ttid = require('./ttid.js');
引用本地的模板,这样是不允许的吗?之前老的版本这样没有问题呢?

@sorrycc
Copy link
Member

sorrycc commented Apr 28, 2015

新版本不可以,或者说 webpack 不可以。

不能 require output 中指定的文件。

@zvrr
Copy link
Author

zvrr commented Apr 28, 2015

那这个问题在新版里面要怎么做呢?谢谢

@sorrycc
Copy link
Member

sorrycc commented Apr 28, 2015

  • 需要被依赖的文件就不要放在 output 里
  • 既需要被依赖又需要被输出的文件,就单独再起一个文件,只 require 他

@cfansimon
Copy link

既需要被依赖又需要被输出的文件,就单独再起一个文件,只 require 他
具体的做法是?

@sorrycc
Copy link
Member

sorrycc commented Jun 30, 2015

比如要输出 a 和 b,而 a 又 require 了 b,这时会报上面的错。可以新建一个 c,把 b 的内容给 c,然后 a 和 b 都 require c,这样就不会报错了。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants