Skip to content

Commit

Permalink
fix: use default export for unpath, close #10
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 31, 2021
1 parent 99ff577 commit 5a3645a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 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 { dirname, join, resolve } from 'upath'
import type { Resolver } from 'enhanced-resolve'
import path from 'upath'
import VirtualModulesPlugin from 'webpack-virtual-modules'
import type { Resolver } from 'enhanced-resolve'
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.js')
const LOAD_LOADER = resolve(_dirname, 'webpack/loaders/load.js')
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')

export function getWebpackPlugin<UserOptions = {}> (
factory: UnpluginFactory<UserOptions>
Expand All @@ -27,7 +27,7 @@ export function getWebpackPlugin<UserOptions = {}> (
rawPlugin,
{
__unpluginMeta: meta,
__virtualModulePrefix: join(process.cwd(), 'virtual:')
__virtualModulePrefix: path.join(process.cwd(), 'virtual:')
}
) as ResolvedUnpluginOptions

Expand Down

1 comment on commit 5a3645a

@Heartnett
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please sign in to comment.