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

Exclude @storyblok/js from @storyblok/vue build #656

Open
1 task done
juusopiikkila opened this issue May 28, 2024 · 0 comments
Open
1 task done

Exclude @storyblok/js from @storyblok/vue build #656

juusopiikkila opened this issue May 28, 2024 · 0 comments
Labels
feature [Issue] New feature or request pending-triage [Issue] Ticket is pending to be prioritised

Comments

@juusopiikkila
Copy link

juusopiikkila commented May 28, 2024

Description

I am looking to modify the Vite configuration for the @storyblok/vue package to ensure that the @storyblok/js library is not bundled within the distribution build. The intention is to treat @storyblok/js as an external dependency, which should be loaded separately rather than being included in the final build output.

Suggested solution or improvement

Original Configuration:
The original Vite configuration for @storyblok/vue included only Vue as an external dependency, and did not consider @storyblok/js. Here’s the pertinent part of the original setup:

// Original Rollup Options
rollupOptions: {
  output: {
    globals: {
      vue: "Vue",
    },
  },
  external: ["vue"],
}

Modified Configuration:
In the new configuration, I added @storyblok/js as an external module and defined a global variable for it to ensure it is not bundled with the distribution. The updated configuration is as follows:

// Updated Rollup Options
rollupOptions: {
  output: {
    globals: {
      vue: "Vue",
      '@storyblok/js': "StoryblokJS",
    },
  },
  external: ["vue", '@storyblok/js'],
}

Additional context

With the new configuration, the expectation is that @storyblok/js will be referenced as an external resource in projects utilizing @storyblok/vue, thereby reducing the bundle size and separating concerns.

Validations

@juusopiikkila juusopiikkila added enhancement pending-triage [Issue] Ticket is pending to be prioritised labels May 28, 2024
@juusopiikkila juusopiikkila changed the title Exclude @storyblok/js-client from @storyblok/vue build Exclude @storyblok/js from @storyblok/vue build Jun 7, 2024
@alvarosabu alvarosabu added feature [Issue] New feature or request and removed pending-author labels Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature [Issue] New feature or request pending-triage [Issue] Ticket is pending to be prioritised
Projects
None yet
Development

No branches or pull requests

2 participants