Giter VIP home page Giter VIP logo

Comments (6)

afterwind-io avatar afterwind-io commented on August 22, 2024

@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.

cowardcalf avatar cowardcalf commented on August 22, 2024

@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.

afterwind-io avatar afterwind-io commented on August 22, 2024

@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.

cowardcalf avatar cowardcalf commented on August 22, 2024

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.

The error is like below:
image

Thanks.

from preprocessor-loader.

afterwind-io avatar afterwind-io commented on August 22, 2024

@cowardcalf
The problem in #4 does still exist. I have reopened the issue.

from preprocessor-loader.

cowardcalf avatar cowardcalf commented on August 22, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.