ruby-on-rails - 添加 Webpacker 自定义加载器会使 webpacker 行为不正确
问题描述
如果我添加一个自定义加载器,例如 haml 加载器:
// config/webpack/rules/haml.js
module.exports = {
module: {
rules: [
{
test: /\.haml$/,
loader: 'haml-haml-loader'
}
]
},
resolve: {
extensions: ['.haml']
}
}
// config/webpack/base.js
const { webpackConfig, merge } = require('@rails/webpacker')
const hamlConfig = require('./rules/haml')
module.exports = merge(hamlConfig, webpackConfig)
一些应用程序文件停止加载。例如,我收到 Angular 错误,因为未加载相应的文件:
TypeError: Cannot read properties of undefined
只需删除此自定义加载程序即可使一切正常。当添加任何自定义加载器时,应用程序文件由于某种原因停止加载。有什么想法吗?
Webpacker 版本为 6。官方文档:https ://github.com/rails/webpacker#typescript
解决方案
推荐阅读
- azure-functions - 我们如何计算运行编排功能的总时间
- node.js - 提供所需值时如何修复 mongoose 验证器错误,但 mongoose 无法识别
- python - Keras get_weights() 不返回所有权重
- python - 在 Windows 机器上,安装了 Python 3.7,但似乎 3.6 正在运行
- python - 如何测试比较的用法?
- c - 奇怪的 mktime() 行为
- c# - 剃须刀页面中移动设备的页面不同但路由相同
- python - 如何在每 5 个数字后添加换行符?
- html - 在特定模板中分别渲染具有 Status = Accept 或 Reject 的 Django 对象
- reactjs - 如何使用 React Js 更改 SASS 变量值?