Sto convertendo un progetto usando requirejs nel webpack e avendo problemi con il caricatore "html-loader".Webpack non può risolvere html-loader
package.json:
"html-loader": "^0.3.0",
"webpack": "^1.11.0",
"webpack-dev-server": "^1.10.1"
app/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']
)
)
]
Quando eseguo webpack - webpack --config app/js/webpack.config.js
- ottengo il seguente messaggio di errore:
ERROR in app/js/some/file.js
Module not found: Error: Cannot resolve module 'html' in app/js/some/file.js
Ho provato quanto segue, che non ha funzionato:
resolveLoader: {
root: [path.join(__dirname, 'node_modules')],
},
Ha anche provato a spostare "webpack.config.js" nella radice del progetto. Neanche questo ha aiutato.
E, anche provato a utilizzare il caricatore "caricatore raw", che ha anche provocato lo stesso errore "Impossibile risolvere il modulo 'raw'".
Qualsiasi aiuto sarebbe apprezzato. Grazie.
è possibile includere i tuoi 'app/js/some/file.js' qui? – lanan
Ci scusiamo per una domanda stupida, ma sei assolutamente sicuro che ** html-loader ** e ** raw-loader ** siano installati correttamente? Forse ti manca qualche errore quando esegui 'npm install'? – Kreozot