Skip to content

Commit

Permalink
build: 修改模块导出方式
Browse files Browse the repository at this point in the history
  • Loading branch information
OSpoon committed Mar 22, 2024
1 parent 2996888 commit 930ddf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions build.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rmSync } from 'node:fs'
import { join } from 'node:path'
import { appendFileSync, rmSync } from 'node:fs'
import { defineBuildConfig } from 'unbuild'

export default defineBuildConfig({
Expand All @@ -20,7 +20,6 @@ export default defineBuildConfig({
['index.d.cts', 'index.d.mts', 'index.mjs'].forEach((file) => {
rmSync(join(ctx.options.outDir, file))
})
appendFileSync(join(ctx.options.outDir, 'index.cjs'), `module.exports.postcss = true;`)
},
},
})
5 changes: 4 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function skipFiles(rule: Rule | undefined, exclude: RegExp | undefined) {
return exclude.test(file)
}

export default function dynamicPixel(opts?: DynamicPixelOptions): Plugin {
function dynamicPixel(opts?: DynamicPixelOptions): Plugin {
const options = Object.assign({}, defaultOptions, opts)
return {
postcssPlugin: 'postcss-dynamic-pixel',
Expand Down Expand Up @@ -135,3 +135,6 @@ export default function dynamicPixel(opts?: DynamicPixelOptions): Plugin {
},
}
}

dynamicPixel.postcss = true
export default dynamicPixel

0 comments on commit 930ddf8

Please sign in to comment.