Comments (6)
@cowardcalf
The loader doesn't have any so-called Global Context
. You can write the config like this:
module.exports = {
// ...
module: {
rules: [
{
test: /\.scss$/,
use: [
// Other loaders...
{
loader: 'webpack-preprocessor-loader',
// Options...
},
],
},
{
test: /\.html$/,
use: [
// Other loaders...
{
loader: 'webpack-preprocessor-loader',
// Options...
},
],
},
// Other rules...
],
},
};
After all the loader is just a plain function, which takes file as string, and outputs the processed result.
from preprocessor-loader.
@afterwind-io
Thanks for that.
I've found that it has a similar issue when parsing the .scss
files (not testing the html).
I've followed the config and adding extra empty line at the end of the .scss
, and it works.
I guess you may need to fix it for the .scss
, .html
and the other as well?
from preprocessor-loader.
@cowardcalf
This specific problem is irrelevant to the file format nor config.
I just set up a new empty project, tested the v1.1.1 and it works. Please make sure updating to the latest version. Maybe uninstall it first then reinstall and check the version listed in the package.json
. It should be ^v1.1.1
.
If the problem still exists, would you please providing some minimum samples of the config and the file you're dealing with?
from preprocessor-loader.
Hi, @afterwind-io
Thanks for your reply.
First of all, I'm sure I'm using the v1.1.1.
Second, with the v1.1.1, it does work with the .js
files without any extra empty line. But it doesn't work for .scss
/.css
file.
Please see the demo repo forked and modified from https://github.com/sanchan/react-simple-boilerplate.
Note: adding an extra line at the end of /src/css/index.css
, the error will be gone.
Thanks.
from preprocessor-loader.
@cowardcalf
The problem in #4 does still exist. I have reopened the issue.
from preprocessor-loader.
@cowardcalf
The problem in #4 does still exist. I have reopened the issue.
No worries.
Thanks for your patience and quick response.
from preprocessor-loader.
Related Issues (20)
- The if directive implementation may cause wrong result HOT 2
- vue cli3 怎么配置json格式 HOT 4
- Doesn't work with cache in webpack 5 HOT 6
- sass import 后条件编译无效 HOT 2
- 自定义前缀 HOT 1
- vue-loader@next not working HOT 2
- 有没有考虑出vite 版的
- Whether vue3 version is supported or not, tempalte will not work HOT 1
- 有时候打包构建后的项目,条件判断会失效 HOT 1
- Nested if statements don't resolve correctly. HOT 4
- Functions in params are not defined for the first time with thread-loader HOT 1
- Test libraries HOT 1
- Verbose mode breaks in html files with css comments HOT 4
- v1.2.1 - comments processed incorrectly HOT 1
- No errors when missing closing endifs
- Failed when having export default from imported HOT 7
- Support for Angular Project Generated by Angular CLI
- 请教下,你的 README 中的 Badge 是如何自动生成的呢? HOT 3
- How can I use this with oneOf? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from preprocessor-loader.