Skip to content

Commit 930ddf8

Browse files
committed
build: 修改模块导出方式
1 parent 2996888 commit 930ddf8

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

build.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { rmSync } from 'node:fs'
12
import { join } from 'node:path'
2-
import { appendFileSync, rmSync } from 'node:fs'
33
import { defineBuildConfig } from 'unbuild'
44

55
export default defineBuildConfig({
@@ -20,7 +20,6 @@ export default defineBuildConfig({
2020
['index.d.cts', 'index.d.mts', 'index.mjs'].forEach((file) => {
2121
rmSync(join(ctx.options.outDir, file))
2222
})
23-
appendFileSync(join(ctx.options.outDir, 'index.cjs'), `module.exports.postcss = true;`)
2423
},
2524
},
2625
})

src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function skipFiles(rule: Rule | undefined, exclude: RegExp | undefined) {
8787
return exclude.test(file)
8888
}
8989

90-
export default function dynamicPixel(opts?: DynamicPixelOptions): Plugin {
90+
function dynamicPixel(opts?: DynamicPixelOptions): Plugin {
9191
const options = Object.assign({}, defaultOptions, opts)
9292
return {
9393
postcssPlugin: 'postcss-dynamic-pixel',
@@ -135,3 +135,6 @@ export default function dynamicPixel(opts?: DynamicPixelOptions): Plugin {
135135
},
136136
}
137137
}
138+
139+
dynamicPixel.postcss = true
140+
export default dynamicPixel

0 commit comments

Comments
 (0)