Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ms185226 opened this issue Nov 4, 2021 · 1 comment

Comments

@ms185226
Copy link

ms185226 commented Nov 4, 2021

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 ms185226 changed the title Module build failed Error: The path for file doesn't contain relativeTo param Module build failed Error: The path for file doesn't contain relativeTo param - Not able to bundle the htmls of parallel module Nov 4, 2021
@coderxsjah
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants