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

Using structured:true generates wrong path #78

Closed
Rusl10 opened this issue Jan 24, 2024 · 3 comments
Closed

Using structured:true generates wrong path #78

Rusl10 opened this issue Jan 24, 2024 · 3 comments

Comments

@Rusl10
Copy link

Rusl10 commented Jan 24, 2024

Hi. Consider we have the following code

// vite.config.mts
export default mergeConfig(baseConfig, {
  ...,
  plugins: [
    viteStaticCopy({
      targets: [
        {
          src: normalizePath(path.resolve(process.cwd(), 'polymer-bundles/calendar/es6-bundled/**')),
          dest: 'polymer-bundles/calendar',
        }
      ],
      structured: true,
    })
  ],
});

I have to make the following changes to copy my files correctly

// node_modules/vite-plugin-static-copy/dist/index.js
// const dirClean = dir.replace(/^(?:\.\.\/)+/, "");
const dirClean = dir.replace(/^(?:\.\.\/)+/, "").replace("/home/admin/Desktop/projects/mln/polymer-bundles/calendar/es6-bundled", "");
const destClean = `${dest}/${dirClean}`.replace(/^\/+|\/+$/g, "");
destDir = destClean;

By default I get wrong path in destClean variable: /home/admin/Desktop/projects/mln/dist/apps/web/app/shell/polymer-bundles/calendar/home/admin/Desktop/projects/mln/polymer-bundles/calendar/es6-bundled
Could you fix this please?
P.S. I use vite with nx. OS ubuntu.

@sapphi-red
Copy link
Owner

There was a bug (#79) related to that but you can use rename option to do that.

@Rusl10
Copy link
Author

Rusl10 commented Jan 29, 2024

@sapphi-red If i start preview server everything works fine, but it does not work for a dev server. Could you help to solve it please ?

@sapphi-red
Copy link
Owner

I need a reproduction for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants