Skip to content

Commit

Permalink
fix: preserve css imports in commonjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS committed Oct 31, 2023
1 parent 0524ec0 commit fb5ac73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 35 deletions.
14 changes: 0 additions & 14 deletions src/common/library/babel-plugin-remove-css-imports.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/common/library/babel-plugin-remove-css-paths.test.ts

This file was deleted.

13 changes: 11 additions & 2 deletions src/common/library/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function compileToCjs(
babelrc: false,
filename: sourceFile,
plugins: [
require.resolve('./babel-plugin-remove-css-imports'),
require.resolve('@babel/plugin-transform-modules-commonjs'),
require.resolve('@babel/plugin-transform-dynamic-import'),
],
Expand Down Expand Up @@ -296,7 +295,17 @@ export function buildLibrary(config: LibraryConfig) {

// css compilation
compileStyles(paths.libGlobalStyles, paths.libCompiledGlobalStyles, () => {
compileStyles(paths.src, paths.libBuildEsm, undefined, internalGlobs);
compileStyles(
paths.src,
paths.libBuildEsm,
() => {
const stylesStream = globStream(['**/*.{css,css.map}'], {
cwd: paths.libBuildEsm,
});
stylesStream.on('data', copyToCjs);
},
internalGlobs,
);
});

// icons compilation to js
Expand Down

0 comments on commit fb5ac73

Please sign in to comment.