我有一个打字稿文件,我正在导入各种打字稿文件,如下所示:
import ThingAMajig from '../../../libs/stuffs/ThingAMajig'; // a typescript file
但我必须以这种方式导入我的coffeescript文件:
const CoolThing = require('../../../libs/coolDir/CoolThing');
当我尝试使用导入语法时,出现错误error TS2307: Cannot find module
。
答案 0 :(得分:0)
我可以半回答这个问题。我对babel,webpack和打字稿有所了解 您需要更多地研究咖啡装载机 https://github.com/webpack-contrib/coffee-loader
我以前习惯在Mac上使用brew
你也可以sudo npm安装webpack,
或者在Windows机器上以管理员身份执行。
webpack.config.js
module.exports = {
entry: '/scripts.js'
output: {filename 'bundle.js'}
module: {
loaders: [
{test: /\.js?/, loader: 'babel-loader', exclude: /node_modules}
]
}
}