Skip to content

Combine strip and rename easier #239

@nlsteers

Description

@nlsteers

Hi there,

Prior to the 4.0.0 release I was able to do the following:

{
  dest: 'public/javascripts',
  rename: 'a-clientside-function.js',
  src: 'node_modules/path/to/dependency/build/esm/index.js'
}

Which would then be in my dist as public/javascripts/a-clientside-function.js.

It now looks like this is no longer possible (without implementing it as a rename function).

Would it be possible to reintroduce the ability to combine strip and rename?

I have had to add the following into my vite config (which I would rather not 😅):

rename: (_name, _ext, fullPath) => {
    const dir = path.relative(process.cwd(), path.dirname(fullPath))
    const depth = dir ? dir.split('/').filter(Boolean).length : 0
    return `${'../'.repeat(depth)}a-clientside-function.js`
},

Thanks for all the great work on this plugin.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions