Skip to content

Commit

Permalink
Merge pull request #34 from vordgi/ncm-33
Browse files Browse the repository at this point in the history
ncm-33 fix working with nextjs spec loaders
  • Loading branch information
vordgi authored Jan 14, 2024
2 parents 140c409 + b3063f0 commit ec96b49
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-classnames-minifier",
"version": "2.1.0",
"version": "2.1.1",
"description": "Library for configuring style modules to generate compressed classes",
"main": "dist/withClassnamesMinifier.js",
"types": "dist/withClassnamesMinifier.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions src/lib/next-classnames-minifier-postloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { LoaderContext } from 'webpack';
import ConverterMinified from './converters/ConverterMinified';
import fs from 'fs';

export default function (this: LoaderContext<any>, source: string) {
export default function (this: LoaderContext<any>, source: string, map: any, meta: any) {
const options = this.getOptions();
const classnamesMinifier = options.classnamesMinifier as ConverterMinified;
Object.entries(classnamesMinifier.dirtyСache).forEach(([resourcePath, data]) => {
Expand All @@ -13,5 +13,6 @@ export default function (this: LoaderContext<any>, source: string) {
}
})

return source;
this.callback(null, source, map, meta);
return;
}
5 changes: 3 additions & 2 deletions src/lib/next-classnames-minifier-preloader.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { LoaderContext } from 'webpack';
import ConverterMinified from './converters/ConverterMinified';

export default function (this: LoaderContext<any>, source: string) {
export default function (this: LoaderContext<any>, source: string, map: any, meta: any) {
const options = this.getOptions();
const classnamesMinifier = options.classnamesMinifier as ConverterMinified;
const maybeClassesList = source.match(/\.[a-zA-Z_][a-zA-Z0-9_-]+/g)
Expand All @@ -13,5 +13,6 @@ export default function (this: LoaderContext<any>, source: string) {
) : {};
}

return source;
this.callback(null, source, map, meta);
return;
}

0 comments on commit ec96b49

Please sign in to comment.