javascript - 在 webpack 中使用模板字符串 [Javascript]
问题描述
我对 webpack 还很陌生,在编译我的代码时遇到了这个错误。
ERROR in Error: Child compilation failed:
Module build failed (from ../node_modules/html-loader/index.js):
Error: Line 539: Unexpected identifier
这也是它所指的线。
return `background: linear-gradient(to bottom right, ${this.gradientStart}, ${this.gradientEnd});`
是否可以在 Webpack 中允许模板字符串?这是我的 webpack 配置的内部
const html = {
test: /\.(html)$/,
// exclude: /\.html$/,
use: [
{
loader: 'html-loader',
options: {
interpolate: true,
},
},
],
};
解决方案
推荐阅读
- c# - 与归档连接时DatagridView显示错误
- javascript - 对 Firestore 数据的查询返回数据库凭据而不是集合或文档
- ruby-on-rails - 使用 wicked_pdf 中间磨损重定向到 .pdf url 时,rails 应用程序挂起,但在系统超时后在 /tmp 中生成 pdf 文件
- linux - 如何启动 n 个子进程和一个“秒表”进程;只有在活动进程完成后才停止秒表?
- hibernate - 如何将非规范化表映射到两个实体?
- json - 遍历数组并获取多个值
- azure - Azure Webjobs 静态变量
- c++ - C ++在变量给定的指定时间范围内关闭PC
- css - 图像边角不应该相互接触
- c# - 无法显示用户选择的列表项的正确索引