html-loader无效,Webpack无法解析html-loader

我正在使用requirejs将项目转换为webpack,并且遇到了"html-loader"加载器的问题.

的package.json:

"html-loader": "^0.3.0",

"webpack": "^1.11.0",

"webpack-dev-server": "^1.10.1"

应用程序/ JS/webpack.config.js:

// folder structure:

// root

// app/js

// bower_components/

// dist/

// node_modules/

entry: './app/js/main.js',

output: {

path: 'dist/js/',

filename: 'bundle.js',

},

module: {

loaders: [

// Note, via requirejs's "text" plugin, I included templates

// like this: var tpl = require('text!sample.html');

// For webpack, I went through the codebase and cleaned up

// every instance of "text!".

{test: /\.html$/, loader: 'html'}

]

},

resolve: {

root: ['app/js', 'bower_components'],

alias: {

...

}

},

plugins: [

new webpack.ResolverPlugin(

new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin(

'bower.json', ['main']

)

)

]

当我运行webpack - 时webpack --config app/js/webpack.config.js,我收到以下错误消息:

app/js/some/file.js中的

错误找不到模块:错误:无法解析app/js/some/file.js中的模块'html'

我尝试了以下,但没有用:

resolveLoader: {

root: [path.join(__dirname, 'node_modules')],

},

还尝试将"webpack.config.js"移动到项目根目录.这也没有帮助.

并且,甚至尝试使用"原始加载器"加载器,这也导致相同的"无法解析模块'原始'"错误.

任何帮助,将不胜感激.谢谢.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值