Skip to content

Commit

Permalink
fix: windows path resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 25, 2021
1 parent ada8186 commit c9055aa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"test:build": "yarn build && jiti scripts/buildFixtures.ts"
},
"dependencies": {
"upath": "^2.0.1",
"webpack-virtual-modules": "^0.4.3"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions src/webpack/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import fs from 'fs'
import { fileURLToPath } from 'url'
import path from 'upath'
import { resolve, dirname, join } from 'path'
import VirtualModulesPlugin from 'webpack-virtual-modules'
import type { Resolver, ResolveRequest } from 'enhanced-resolve'
import type { UnpluginContextMeta, UnpluginInstance, UnpluginFactory, WebpackCompiler, ResolvedUnpluginOptions } from '../types'

const _dirname = typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url))
const TRANSFORM_LOADER = path.resolve(_dirname, 'webpack/loaders/transform.js')
const LOAD_LOADER = path.resolve(_dirname, 'webpack/loaders/load.js')
const _dirname = typeof __dirname !== 'undefined' ? __dirname : dirname(fileURLToPath(import.meta.url))
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 All @@ -27,7 +27,7 @@ export function getWebpackPlugin<UserOptions = {}> (
rawPlugin,
{
__unpluginMeta: meta,
__virtualModulePrefix: path.join(process.cwd(), '_virtual_')
__virtualModulePrefix: join(process.cwd(), '_virtual_')
}
) as ResolvedUnpluginOptions

Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5284,11 +5284,6 @@ universalify@^2.0.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717"
integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==

upath@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/upath/-/upath-2.0.1.tgz#50c73dea68d6f6b990f51d279ce6081665d61a8b"
integrity sha512-1uEe95xksV1O0CYKXo8vQvN1JEbtJp7lb7C5U9HMsIp6IVwntkH/oNUzyVNQSd4S1sYk2FpSSW44FqMc8qee5w==

uri-js@^4.2.2:
version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
Expand Down

0 comments on commit c9055aa

Please sign in to comment.