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

Feat/new resolver #169

Merged
merged 7 commits into from
Mar 18, 2017
Merged

Feat/new resolver #169

merged 7 commits into from
Mar 18, 2017

Conversation

jhnns
Copy link
Member

@jhnns jhnns commented Mar 17, 2017

This PR introduces two important changes:

  • It lets you decide between the basic Less resolver and the webpack resolver. If you pass a paths option, it will disable webpack's resolver and use the given paths as include paths. You can also set an empty paths array to disable webpack's resolver without specifying any include paths.
  • If the webpack resolver is used, you are allowed to import non-less files given you have configured the loader pipeline correctly such as
// webpack.config.js
module.exports = {
    ...
    module: {
        rules: [
            {
                test: /\.js$/,
                // if the requesting module is a less file, than use this loader pipeline
                issuer: /\.less$/,
                use: [{
                    loader: require.resolve("./jsToLessLoader.js")
                }]
            },
            {
                test: /\.less$/,
                use: [{
                    loader: "css-loader"
                }, {
                    loader: "less-loader"
                }]
            }
        ]
    }
};

As a breaking change, an undocumented root option was removed. This is unlikely to break anything since it was undocumented, but it's still a breaking change.

jhnns added 4 commits March 17, 2017 01:14
BREAKING CHANGE: The root option was never documented, so it's very unlikely that this is actually a breaking change. However, since the option was removed, we need to flag this as breaking.
This change enables the user to import any file if the loader pipeline is configured in such a way that non-less files are translated. The loader pipeline for non-less files is typically configured with the `issuer` condition matching the .less file extension.
If a paths property is set in the options, it will effectively disable webpack's resolver. This allows you to use Less' default resolver which is usually faster. However, if you choose to set the paths, you won't be able to use webpack features like resolve.alias or importing other file types.

This is not a breaking change because setting the paths hasn't worked properly before this anyway.
@codecov
Copy link

codecov bot commented Mar 17, 2017

Codecov Report

Merging #169 into master will increase coverage by 0.12%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #169      +/-   ##
==========================================
+ Coverage   98.61%   98.73%   +0.12%     
==========================================
  Files           7        7              
  Lines          72       79       +7     
  Branches        4        5       +1     
==========================================
+ Hits           71       78       +7     
  Misses          1        1
Impacted Files Coverage Δ
src/getOptions.js 100% <100%> (ø)
src/stringifyLoader.js 100% <100%> (ø)
src/createWebpackLessPlugin.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0a3d0af...45ff5ca. Read the comment docs.

@jhnns jhnns merged commit 2bdabf5 into master Mar 18, 2017
@jhnns jhnns deleted the feat/new-resolver branch March 18, 2017 15:50
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 this pull request may close these issues.

1 participant