Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new replacePath util #12

Merged
merged 1 commit into from
Sep 7, 2024
Merged

feat: add new replacePath util #12

merged 1 commit into from
Sep 7, 2024

Conversation

ivodolenc
Copy link
Member

Type of Change

  • New feature
  • Documentation

Request Description

Adds new replacePath util.

replacePath

  • Type: (path: RegExp | string, replace: string): (id: string) => string

Replaces the external module ID with a custom value.

import { defineConfig, replacePath } from '@hypernym/bundler'

export default defineConfig({
  entries: [
    {
      input: './src/index.ts',
      output: './dist/index.mjs',
      externals: [/^@\/path/],
      // replaces `@/path` with `./path/index.mjs`
      paths: (id) => replacePath(/^@\/path/, './easing/index.mjs')(id),
    },
  ],
})

@ivodolenc ivodolenc added the feat New feature label Sep 7, 2024
@ivodolenc ivodolenc merged commit d825af4 into main Sep 7, 2024
@ivodolenc ivodolenc deleted the feat/replace-path branch September 7, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant