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

🐛Bug Report: Stopped working with html-loader v1.0.0 #23

Closed
cb-eli opened this issue Mar 25, 2020 · 6 comments
Closed

🐛Bug Report: Stopped working with html-loader v1.0.0 #23

cb-eli opened this issue Mar 25, 2020 · 6 comments
Labels

Comments

@cb-eli
Copy link

cb-eli commented Mar 25, 2020

Describe the bug
html-loader was updated to v1.0.0 with breaking changes. Since then ngtemplate-loader is breaking my build.

Urgency
⏰Normal

To Reproduce

  1. Update html-loader to v1.0.0
  2. Run webpack build

Environment

  • OS: Windows 10.0
  • Node.js version: v13.7.0
  • webpack version: 4.42.1
  • auto-ngtemplate-loader version: 2.1.0

Additional context
Webpack config:

        resolveLoader: {
            alias: {
                'ngtemplate': 'ngtemplate-loader?relativeTo=' + path.resolve(__dirname, CONSTS.SCRIPTS) + '/'
            }
        },

Error:

Uncaught Error: Module parse failed: Unexpected token (3:0)
File was processed with these loaders:
 * ./node_modules/ngtemplate-loader/index.js
 * ./node_modules/html-loader/dist/cjs.js
You may need an additional loader to handle the result of these loaders.
| var path = 'Application/Common/Templates/Directives/dropdown.html';
| var html = // Module
> var code = "<div>test</div>";
| // Exports
| module.exports = code;;
    at Object../node_modules/ngtemplate-loader/index.js?relativeTo=C:\Projects\project-name\Code\WebSite\project-name\Scripts/!./Scripts/Application/Common/Templates/Directives/dropdown.html (MyScript.js:1363)
    at __webpack_require__ (bootstrap:84)
    at Module../Scripts/Application/Pages/xxx/xxx/Directives/xxx.js (xxx.js:635)
    at __webpack_require__ (bootstrap:84)
    at Module../Scripts/Application/Pages/xxx/xxx/Directives/xxx.js (xxx.js:1)
    at __webpack_require__ (bootstrap:84)
    at Module../Scripts/Application/Pages/xxx/xxx/Directives/xxx.js (xxx.js:1)
    at __webpack_require__ (bootstrap:84)
    at Module../Scripts/Application/Pages/xxx/xxx/Directives/xxx.js (xxx.js:1)
    at __webpack_require__ (bootstrap:84)
@cb-eli cb-eli added the bug label Mar 25, 2020
@YashdalfTheGray
Copy link
Owner

Okay so I did some looking into it, it seems like this code picks up the wrong thing after the update because it's probably looking for a very specific string to be where it's not. My current hypothesis is that the html-loader output changed in some way. Consequently, it makes this code not work the way that it should which causes the error.

At least for right now, until ngtemplate-loader is fixed, you can pin the version of html-loader to be "0.5.5" and that won't break the build.

@YashdalfTheGray
Copy link
Owner

I'm definitely not fully awake, I found this issue in the ngtemplate-loader repo that you've opened that has gotten to a similar root cause as me. 😅

Oh well. I learned something new.

@cb-eli
Copy link
Author

cb-eli commented Mar 25, 2020

Okay so I did some looking into it, it seems like this code picks up the wrong thing after the update because it's probably looking for a very specific string to be where it's not. My current hypothesis is that the html-loader output changed in some way. Consequently, it makes this code not work the way that it should which causes the error.

At least for right now, until ngtemplate-loader is fixed, you can pin the version of html-loader to be "0.5.5" and that won't break the build.

Yes, for now I pinned to 0.5.5. Thanks for the response :)

@chiptus
Copy link

chiptus commented Sep 2, 2020

ngtemplate-loader should be released with a fix soon, no change needed in this plugin.

@YashdalfTheGray
Copy link
Owner

Ack!

@YashdalfTheGray
Copy link
Owner

https://www.npmjs.com/package/auto-ngtemplate-loader

Published a 3.1.0 with updated dependency versions for html-loader.

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

No branches or pull requests

3 participants