WebPack可以解决数据:文本导入
我的应用程序使用具有语法的第三方库:
const module = await import(`data:text/javascript;charset=utf-8,${content}`);
通过WebPack构建时,我会收到以下错误:
ERROR in ./node_modules/@web/test-runner-commands/browser/commands.mjs
Module not found: Error: Can't resolve 'data:text' in 'C:\path_to_project\node_modules\@web\test-runner-commands\browser'
我尝试在WebPack配置中使用Babel-Loader:
module: {
rules: [
{
test: /\.m?js$/,
include: [
path.resolve(workingDirectory, 'node_modules/@web')
],
use: 'babel-loader'
}
]
}
我需要帮助弄清楚哪些Loader能够解释表达式。
My app uses a third party library that has the syntax:
const module = await import(`data:text/javascript;charset=utf-8,${content}`);
While building through Webpack I am getting the following error:
ERROR in ./node_modules/@web/test-runner-commands/browser/commands.mjs
Module not found: Error: Can't resolve 'data:text' in 'C:\path_to_project\node_modules\@web\test-runner-commands\browser'
I tried using babel-loader in my Webpack config:
module: {
rules: [
{
test: /\.m?js$/,
include: [
path.resolve(workingDirectory, 'node_modules/@web')
],
use: 'babel-loader'
}
]
}
I need help figuring out what loader would be able to interpret the expression.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
两年后有点迟了,但是我收到了相同的错误消息,很难找到任何帮助。
我还在使用Bable-Loader。
这是我的WebPack的片段,它摆脱了警告:
it's a bit late after 2 years, but I had the same error message and it was hard to find any help.
I'm also using the bable-loader.
Here is the snippet of my webpack, that got rid of the Warning: