gpt4 book ai didi

vue.js - 模块解析失败 : Unexpected character '@' while running yarn run storybook with vue-loader

转载 作者:行者123 更新时间:2023-12-04 04:24:00 26 4
gpt4 key购买 nike

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 warn]: Failed to mount component: template or render function not defined. found in

当我添加时它就解决了

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 部分。


在尝试了不同的选项后,当在 .storybook/ 文件夹中创建一个包含以下内容的 webpack.config.js 文件时,错误得到解决。

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 命令。

关于vue.js - 模块解析失败 : Unexpected character '@' while running yarn run storybook with vue-loader,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58303411/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com