vue.js - 模块解析失败:使用 vue-loader 运行 yarn run storybook 时出现意外字符“@”
问题描述
yarn run storybook
因错误而失败
具体细节是:
Module parse failed: Unexpected character '@'
File was processed with these loaders:
* ./node_modules/vue-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
故事书5.2.3
网络包4.41.0
解决方案
更新:
这导致我另一个错误
[Vue 警告]:无法挂载组件:未定义模板或渲染函数。在发现
当我添加时它得到了解决
const path = require('path');
module.exports = async ({ config, mode }) => {
config.module.rules.push({
test: /\.ts$/,
exclude: /node_modules/,
use: [
{
loader: 'ts-loader',
options: {
appendTsSuffixTo: [/\.vue$/],
transpileOnly: true
},
}
],
});
return config;
};
并删除了上一vue-loader
节。
在尝试了不同的选项后,当webpack.config.js
在文件夹中创建.storybook/
具有以下内容的文件时,错误得到解决。
const path = require('path');
module.exports = async ({ config, mode }) => {
config.module.rules.push({
test: /\.vue$/,
loader: require.resolve('vue-loader'),
include: path.resolve(__dirname, '../src/'),
});
return config;
};
重要的是解析像这样的加载器插件require.resolve('vue-loader')然后再次重新运行yarn 命令。
推荐阅读
- c# - 如何处理从 bot 框架 v4 中的技能收到的活动?
- docker - 有没有办法在容器中获取容器名称?
- sql - Oracle SQL - 加入和拥有
- ruby-on-rails - 从运行在 Minikube 集群上的 rails 应用程序访问本地 postgres 数据库
- linux - 如何在gid检查下替换文件?
- python - 试图从 git pull 中删除身份验证会创建奇怪的合并冲突和不应该存在的更改
- python - python keras使用计算汉明损失
- resteasy - Rest Client - 我可以设置 connectionPoolSize 吗?
- google-bigquery - 如何在连接查询中选择两次相同的列?
- c++ - 傅里叶级数的表示取决于制表点