Import 使网页包导入模块(原始加载程序)与quokka一起工作。找不到模块错误

Import 使网页包导入模块(原始加载程序)与quokka一起工作。找不到模块错误,import,quokka.js,Import,Quokka.js,我想在一个项目中使用quokka,在这个项目中,我使用原始加载程序从typescript中的其他脚本加载明文。我的问题是,我无法让quokka按照Web包配置中指定的原始加载程序加载模块 在我的webpack.config中,我有以下设置: const srcPath = path.resolve(__dirname, 'src'); module.exports = { resolve: { alias: { '@': srcPath,

我想在一个项目中使用quokka,在这个项目中,我使用原始加载程序从typescript中的其他脚本加载明文。我的问题是,我无法让quokka按照Web包配置中指定的原始加载程序加载模块

在我的webpack.config中,我有以下设置:

const srcPath = path.resolve(__dirname, 'src');
module.exports = {
    resolve: {
        alias: {
          '@': srcPath,
        },
        extensions: ['.tsx', '.ts', '.js', '.js', '.json'],
      },

    {
        test: /\.(vert|frag)$/,
        loader: 'raw-loader',
        include: srcPath,
        exclude: modulesPath,
    },
}
要能够在我的项目中使用特定导入,请执行以下操作:

import vertexShaderSource from '@/shaders/main.vert';
Thant工作得很好。但是当我尝试将quokka合并到我的项目中,并尝试在quokka的config.json中使用@alias时:

{
    "pro":true,
    "plugins":[
        "alias-quokka-plugin",
        "jsdom-quokka-plugin"
    ], 
    "alias": {
        "@/": "./src/"
    }
}
我得到错误:找不到模块'@/shaders/main.vert'。 我试过:

1.-别名中的所有路径组合都是为了避免类型错误,并且还尝试直接在config.json中对路径进行硬编码,但似乎必须使用原始加载程序,并且不知道如何使webpack.config中的逻辑在quokka的config.json中工作

2.-直接对导入中的路径进行硬编码:

import vertexShaderSource from 'fullPathHere';
但根据.eslintrc.js中的eslint导入设置,eslint无法将其识别为模块:

settings: {
    'import/resolver': {
      alias: {
        map: [
          ['@', path.resolve(__dirname, 'src')],
        ],
      },
      node: {
        extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
      },
    },
    'import/parsers': {
      '@typescript-eslint/parser': ['.ts', '.tsx'],
    },
  },
总之,问题是如何使原始加载程序导入的模块与quokka一起工作

编辑:在中,说明了如何根据网页包配置进行quokka导入,因此我将appconfig添加到我的网页包配置文件中:

// in webpack.config.dev
resolve: {
   alias: {
      appconfig: 'path/to/appconfig/dev'
   }
}
更具体地说,在我的webpack.config.js中:

resolve: {
    alias: {
      '@': srcPath,
    },
    extensions: ['.tsx', '.ts', '.js', '.js', '.json'],
    appconfig: 'fullHardcodedPathToMywebpack.config.jsFile',
  },
如文档中所示,但我一直得到模块未找到的错误