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

Unable to import './files.html' after upgrading from 1.1.0 to 1.2.0 #313

Closed
doberkofler opened this issue Aug 18, 2020 · 7 comments · Fixed by #314
Closed

Unable to import './files.html' after upgrading from 1.1.0 to 1.2.0 #313

doberkofler opened this issue Aug 18, 2020 · 7 comments · Fixed by #314

Comments

@doberkofler
Copy link

  • Operating System: macOS
  • Node Version: 14.8.0
  • NPM Version: 6.14.7
  • webpack Version: 4.44.1
  • html-loader Version: 1.2.0

Expected Behavior

import MARKUP from './files.html'; failing after upgrading from 1.1.0 to 1.2.0

Actual Behavior

ERROR in ./src/framework/dropzone/files.html
Module build failed (from ./node_modules/html-loader/dist/cjs.js):
URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at normalizeUrl (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/html-loader/dist/utils.js:358:10)
    at process (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/html-loader/dist/plugins/source-plugin.js:207:45)
    at Object.process (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/html-loader/dist/utils.js:538:19)
    at Object.loader (/Users/doberkofler/MyDev/ljs_app/trunk/periscope/node_modules/html-loader/dist/index.js:58:41)

Code

import MARKUP from './files.html';
@alexander-akait
Copy link
Member

alexander-akait commented Aug 18, 2020

Please create reproducible test repo, it will be automatically closed if you do not fill out reproducible section

@alexander-akait
Copy link
Member

Maybe you are real have bad URL, I can't help without source code of files.html

@doberkofler
Copy link
Author

files.html.zip

@alexander-akait
Copy link
Member

WIP, in the next major release, it will be an error, you will need to use the urlFilter option to exclude non standard src/srcset

@doberkofler
Copy link
Author

I do not understand your comment:

  1. It already is an error in 1.2.0
  2. what am I supposed to do with an ‘urlFilter’?

@alexander-akait
Copy link
Member

It already is an error in 1.2.0

It was fixed in 1.2.1 #314, because it is the regression

what am I supposed to do with an ‘urlFilter’?

In the next major release (html-loader@2) it will output the error, because it is not URL, so you need to use urlFilter to keep them in template without errors using them:

urlFilter: (attribute, value, resourcePath) => {
  if (/^<%= .+ %>$/.test(value)) {
    return false;
  }

  return true;
},

@doberkofler
Copy link
Author

Thank you!

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

Successfully merging a pull request may close this issue.

2 participants