Skip to content

Commit

Permalink
fix: swtich to tsup, fix #10
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 31, 2021
1 parent a8174ef commit 4450e1e
Show file tree
Hide file tree
Showing 4 changed files with 198 additions and 313 deletions.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,27 @@
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs"
"require": "./dist/index.js"
},
"./dist/webpack/loaders/transform": "./dist/webpack/loaders/transform.cjs",
"./dist/webpack/loaders/load": "./dist/webpack/loaders/load.cjs"
"./dist/webpack/loaders/load": "./dist/webpack/loaders/load.js",
"./dist/webpack/loaders/transform": "./dist/webpack/loaders/transform.js"
},
"main": "dist/index.cjs",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"scripts": {
"build": "siroc build",
"dev": "siroc dev",
"build": "tsup",
"dev": "tsup --watch src",
"lint": "eslint --ext ts .",
"release": "yarn build && standard-version && yarn publish --non-interactive && git push --follow-tags",
"test:build": "yarn build && jiti scripts/buildFixtures.ts",
"test": "yarn lint && yarn test:build && jest"
"test": "yarn lint && yarn test:build && jest",
"test:build": "yarn build && jiti scripts/buildFixtures.ts"
},
"dependencies": {
"upath": "^2.0.1",
"webpack-virtual-modules": "^0.4.3"
},
"devDependencies": {
Expand All @@ -44,11 +45,10 @@
"jest": "^27.0.6",
"jiti": "^1.11.0",
"rollup": "^2.56.3",
"siroc": "^0.16.0",
"standard-version": "^9.3.1",
"ts-jest": "^27.0.5",
"tsup": "^4.14.0",
"typescript": "^4.3.5",
"ufo": "^0.7.9",
"vite": "^2.5.1",
"webpack": "^5.51.1",
"webpack-cli": "^4.8.0"
Expand Down
4 changes: 2 additions & 2 deletions src/webpack/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import VirtualModulesPlugin from 'webpack-virtual-modules'
import type { UnpluginContextMeta, UnpluginInstance, UnpluginFactory, WebpackCompiler, ResolvedUnpluginOptions } from '../types'

const _dirname = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url))
const TRANSFORM_LOADER = resolve(_dirname, 'webpack/loaders/transform.cjs')
const LOAD_LOADER = resolve(_dirname, 'webpack/loaders/load.cjs')
const TRANSFORM_LOADER = resolve(_dirname, 'webpack/loaders/transform.js')
const LOAD_LOADER = resolve(_dirname, 'webpack/loaders/load.js')

export function getWebpackPlugin<UserOptions = {}> (
factory: UnpluginFactory<UserOptions>
Expand Down
15 changes: 15 additions & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// tsup.config.ts
import type { Options } from 'tsup'

export const tsup: Options = {
splitting: false,
sourcemap: false,
clean: true,
format: ['cjs', 'esm'],
dts: true,
entryPoints: [
'src/index.ts',
'src/webpack/loaders/load.ts',
'src/webpack/loaders/transform.ts'
]
}
Loading

0 comments on commit 4450e1e

Please sign in to comment.