-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
art-template runtime window未定义 #553
Comments
什么情况会报错? |
重新 npm install 以后就一直报这个错误 |
给一下有助于重现的信息吧,例如 nodejs 和 npm 版本 |
ERROR in Error: /Users/linyi/work/company/sqjh/test/src/pages/index/index.art:769
|
应该是 detect-node 的问题: |
detect-node 通过以下语句判断是否在 node 环境中: module.exports = Object.prototype.toString.call(typeof process !== 'undefined' ? process : 0) === '[object process]'; 以上语句简单理解为 process.toString(); 我在 HtmlWebpackPlugin 中使用 art-template,process.toString 是 [object object],但在 node 中直接执行 process.toString() 是 [object process],不确定是不是 HtmlWebpackPlugin 应该背锅,有可能是其它代码引起的,但可以确认 detect-node 在某些情况下会判断错误。 |
var runtime = Object.create(detectNode ? global : window);
报错 window 未定义
建议安装@fedor/global
var window = require('@fedor/global');
var runtime = Object.create(detectNode ? global : window); 修复此问题
The text was updated successfully, but these errors were encountered: