如何导入文件扩展名为“ .xx”的文件?

时间:2019-05-31 09:14:35

标签: typescript webpack

我想导入一些扩展名特定的文件。

源代码:

index.ts:

import Hello from "./a.xx";

以下是配置文件:

webpack.config.js:

// ...
module: {
    rules [{
        test: /(?:\.ts|\.xx)$/,
        use: "awesome-typescript-loader"
    }]
}
// ...

tsconfig.json:

{
    "compilerOptions": {
        "module": "commonjs",
        "sourceMap": true
    },
    "include": [
        "*.ts",
        "*.xx"
    ]
}

有一些错误:

webpack: Module build failed: Error: Final loader (./node_modules/awesome-typescript-loader/dist/entry.js) didn't return a Buffer or String

awesome-typescript-loader: Child process failed to process the request: TypeError: Cannot read property 'moduleAugmentations' of undefined

0 个答案:

没有答案