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

automatically add rollup-plugin-glslify for lib builds #8

Open
micahscopes opened this issue Apr 2, 2022 · 0 comments
Open

automatically add rollup-plugin-glslify for lib builds #8

micahscopes opened this issue Apr 2, 2022 · 0 comments

Comments

@micahscopes
Copy link

I'm using vite build to bundle a library and had to add both this plugin and rollup-plugin-glslify to avoid confusing rollup. Specifically, I was getting this error.

My plugins look like this:

import { glslify } from "vite-plugin-glslify";
import glslifyRollup from "rollup-plugin-glslify";
...
export default defineConfig({
  ...
  plugins: [glslify(), glslifyRollup()],
  ...
})

The full working vite.config.js:

import { defineConfig } from "vite";
import path, { dirname } from "path";
import { glslify } from "vite-plugin-glslify";
import glslifyRollup from "rollup-plugin-glslify";

const glslifyOptions = {
  extensions: ["vs", "fs", ".glsl", ".frag.shader"],
  compress: true,
  transform: ["glslify-import"],
};

export default defineConfig({
  plugins: [glslify(glslifyOptions), glslifyRollup(glslifyOptions)],

  build: {
    lib: {
      entry: path.resolve(dirname("src/index.js")),
      name: "my library",
      fileName: (format) => `my-library.${format}.js`,
    },
  },
});
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

1 participant