webpack.config.js
:使用文件裝載在的WebPack ES6模塊和打字稿
resolveLoader: {
alias: {
'copy': 'file-loader?name=[path][name].[ext]&context=./src',
}
},
當我使用JavaScript,這工作:
entry.js
:
var index = require("copy!../src/index.html");
但我已經搬到了打字稿,使用(ts-loader),所以我稍微修改了我在做的entry.ts
:
import * as index from 'copy!index.html';
但現在給我一個錯誤:
ERROR in ./src/entry.ts
(3,24): error TS2307: Cannot find module 'copy!../src/index.html'.