ngtemplate-loader icon indicating copy to clipboard operation
ngtemplate-loader copied to clipboard

Module build failed Error: The path for file doesn't contain relativeTo param - Not able to bundle the htmls of parallel module

Open ms185226 opened this issue 3 years ago • 1 comments

I am using Webpack5 to build the below angularjs project

My project structure as below

-Editor

  • App
    • Client index.js .... HTML, js and png files
    • Logic .... htmls, js

I have bundled the HTML, js and png Files of Client module in Client/dist/bundle.min.js file

My index.js file of Client Module also trying to import the htmls available in Logic Module.

In my webpack , I used html-loader and htmlwebpackplungin. Also i have used ngtemplate-loader.

module: { rules: [{ test: /.html$/, oneOf: [ {

  use: [
   {
      loader: 'ngtemplate-loader', options: {
      relativeTo: 'client/',
      module: 'builderClient'
      }
    },
    {
      loader: 'html-loader',
      options: {
      esModule: false,
    },
  }
  ],
  exclude : [path.resolve(__dirname, './node_modules'),
  //path.resolve(__dirname, '../logic/node_modules'),
  path.resolve(__dirname, './index.html')],
},

plugins: [ new HtmlWebpackPlugin({ inject : 'body', template:'./index.html', filename: 'index.html' }), ],

I am receiving the below error for each HTML file available under Logic Module

ERROR in ../logic/scripts/selector/selector.component.html Module build failed (from ./node_modules/ngtemplate-loader/index.js): Error: The path for file doesn't contain relativeTo param at Object.module.exports (C:\sources\Editor\app\client\node_modules\ngtemplate-loader\index.js:38:15) @ ../logic/scripts/ sync .html$ ./selector/selector.component.html @ ./index.js 170:10-62

ms185226 avatar Nov 04 '21 18:11 ms185226

I got the same problem. Is there any method to resolve?

coderxsjah avatar Mar 22 '24 07:03 coderxsjah