当我尝试导入命名导入时,如果名称导入不存在,它将无提示失败。有没有办法让webpack在构建时找不到导入时大声失败
例如:
// file1.js
const var1 = 'var1'
export { var1 }
和
// file2.js
import { var2 } from './file1'
// at this point, var2 is undefined at runtime because it was never exported from file1.js
相反,我希望它在构建时失败。是否有webpack选项或其他一些技术可以用来更快地发现这个错误?
答案 0 :(得分:0)
较新版本的webpack具有此功能。使用版本SELECT sc.IP, sc.Time
FROM sample.connection sc
LEFT JOIN sample.connection t
ON sc.ip = t.ip
AND sc.time<t.time
WHERE t.ip IS NULL;
尝试捆绑问题中的示例时,收到以下警告。这正是我想要的。
"webpack": "^4.16.5"