Konwertuję projekt przy użyciu requirejs na pakiet sieci Web i mam problemy z programem ładującym html-loader.Pakiet Webpack nie może rozwiązać 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']
)
)
]
Kiedy biegnę WebPack - webpack --config app/js/webpack.config.js
- pojawia się następujący komunikat o błędzie:
ERROR in app/js/some/file.js
Module not found: Error: Cannot resolve module 'html' in app/js/some/file.js
Próbowałem następujące, które nie działało:
resolveLoader: {
root: [path.join(__dirname, 'node_modules')],
},
Próbowano również przenieść "webpack.config.js" do katalogu głównego projektu. To też nie pomogło.
I nawet wypróbowany przy użyciu programu ładującego "raw-loader", który również spowodował ten sam błąd "Nie można rozwiązać modułu" nieprzetworzonego ".
Każda pomoc zostanie doceniona. Dzięki.
można dołączyć swoje 'app/js/some/file.js' tutaj? – lanan
Przepraszamy za głupie pytanie, ale czy jesteś absolutnie pewien, że ** html-loader ** i ** raw-loader ** są poprawnie zainstalowane? Może przegapisz jakiś błąd podczas robienia 'npm install'? – Kreozot