Skip to content

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

Description

@ms185226

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions