zengwenfu / compile-nunjucks-loader

3 stars 2 forks source link

ERROR : You may need an appropriate loader to handle this file type. #1

Open DeepenLau opened 7 years ago

DeepenLau commented 7 years ago
 ...
  module: {
    rules: [
      {
        test: /\.(njk|nunjucks)$/,
        use: ['compile-nunjucks-loader']
      }
    ]
  }
...
// plugins
  new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'compile-nunjucks-loader!' + path.resolve(__dirname, './views/index.njk'),
      inject: true,
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        minifyJS: true
      }
    })

    You may need an appropriate loader to handle this file type.
    | <!DOCTYPE html>
    | <html lang="en">
    | <head>

我用法有问题吗?还是不兼容 webpack2 ?

zengwenfu commented 7 years ago

你的模板是怎样写的?我估计你应该还需要加上html-loader处理html,nunjunks-loader只是处理了nunjucks的编译

DeepenLau commented 7 years ago

确实加了 html-loader 就好了,感谢!

zengwenfu commented 7 years ago

不谢,可加微信:facemagic2014,可随时交流

DeepenLau commented 7 years ago

好的,已加~

kobe990 commented 7 years ago

我看html-webpack-plugin依赖里已经有html-loader,不是默认调用处理的?还要手动配置文件里写明吗

zengwenfu commented 7 years ago

要写