Vue.js 模块分析失败:意外字符'@';运行纱线时,使用vue loader运行故事书

Vue.js 模块分析失败:意外字符'@';运行纱线时,使用vue loader运行故事书,vue.js,storybook,vue-loader,Vue.js,Storybook,Vue Loader,纱线运行故事书失败,出现错误 具体详情如下: 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更新: 这使我

纱线运行故事书
失败,出现错误

具体详情如下:

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]:未能装载组件:模板或呈现函数未加载 定义发现于

当我加上

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加载程序
部分


尝试不同的选项后,在
.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')然后再次运行纱线命令