Skip to content

Add ident to loaders passed to child compilation #22

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

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add ident to loaders passed to child compilation
add test case how css deduplication works
  • Loading branch information
sokra committed Mar 7, 2018
commit 31c4cdc4002ae131f8adebbed5d4b529cb3d2a23
1 change: 1 addition & 0 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export function pitch(request) {
return ({
loader: loader.path,
options: loader.options,
ident: loader.ident,
});
});
}
Expand Down
4 changes: 4 additions & 0 deletions test/cases/composes-async/async-1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:local .base {
composes: composed from './async-2.css';
background: blue;
}
3 changes: 3 additions & 0 deletions test/cases/composes-async/async-2.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
:local .composed {
background: green;
}
4 changes: 4 additions & 0 deletions test/cases/composes-async/expected/1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.base {
background: blue;
}

4 changes: 4 additions & 0 deletions test/cases/composes-async/expected/3.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.composed {
background: green;
}

2 changes: 2 additions & 0 deletions test/cases/composes-async/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import('./async-1.css');
import('./async-2.css');
38 changes: 38 additions & 0 deletions test/cases/composes-async/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const Self = require('../../../');

module.exports = {
entry: './index.js',
module: {
rules: [
{
test: /\.css$/,
use: [
Self.loader,
{
loader: 'css-loader',
options: {
localIdentName: '[local]'
}
}
],
},
],
},
optimization: {
splitChunks: {
cacheGroups: {
cssDedupe: {
test: /\.css$/,
chunks: 'all',
minChunks: 2,
enforce: true
}
}
}
},
plugins: [
new Self({
filename: '[name].css',
}),
],
};