-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
explicit requires should override loader pattern #1747
Comments
var template = require('!text!mytemplate.html'); |
Thanks, @sokra! This information is useful and was notably missing from the documentation. I have updated the documentation, let me know if I’m mistaken. And it seems like the issue may be closed now. @geddski, does the answer cover your use case? |
the leading |
If you chain loaders like this: loaders: [{
test: /\.s?css$/,
loader: 'style!css'
}, {
test: /\.scss$/,
loader: 'sass'
}] your SCSS files will be compiled with loaders: [{
test: /\.s?css$/,
loader: 'style!css'
}, {
test: /\.scss$/,
loader: '!style!css!postcss!sass'
}] because this doesn't work 😕 |
@geddski, found this trying to fix the same problem. Ended up working for me. |
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
@sokra I have loader before typescript that replace in source path to html with require call with !raw-loader but it still use file-loader that is defined in global config. |
@sokra answer works perfectly. Thanks. However, I think it's worth mentioning that ESLint forbid the use of inline loaders. I had to rule this config out. |
I confirm the issue. I wanted to override configuration with inline I thought I could have 2 separate configurations:
and use it by:
but unfortunally webpack drops everything after file path before executing the tests :( I can't migrate to webpack 2 due to this issue... :( |
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Yeah, I can't realistically use I also think that |
Could you give more details about your setup? Why does your project contain webpack-specific loader paths if they aren't being consumed by webpack? That behavior is not a bug, so introducing such a breaking change to webpack would have big consequences. |
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Answer above #1747 (comment) Closing because of inactivity |
I still don't understand why it doesn't work the way I expected (and the way other bundlers work), but I am not having this problem anymore. Like others, part of the problem was legacy code used in transition for years. Unlike others, I'm never going to fully transition to an entirely webpack-based runtime. I want to partially compile the requires, and partially "pre-compile" them so that requirejs and other programs can finish the job. I realize now that webpack needs more than the band-aid implied by fixing this to support the workflow I want in the places I want it. I have off-and-on thought about building my own tooling to perform the specifics tasks of preparing files to be consumed by the specific types of things I am using (like requirejs and systemjs) at runtime. |
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Changed the loader for manifest.json from json-loader to file-loader to prevent it being wrapped with module.exports Used approach as described here: webpack/webpack#1747 (comment)
Shouldn't explicit loaders override the webpack config?
For example if my webpack config has a pattern for loading all html files with one loader:
But if somewhere in the app the html file is loaded explicitly with a different loader:
The result is now the output of the ngtemplate loader, instead of the plain text of the file. Is this a bug?
The text was updated successfully, but these errors were encountered: