Socket
Socket
Sign inDemoInstall

@aem-vite/import-rewriter

Package Overview
Dependencies
6
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aem-vite/import-rewriter

Dynamic imports transformer and CSS path rewriter for Vite when using Adobe Experience Manager


Version published
Maintainers
1
Created

Changelog

Source

5.0.0 (2022-02-12)

Code Refactoring

  • remove css rewriter (3c5c49e)

Features

BREAKING CHANGES

  • Complete redesign of the dynamic/native imports handler

The previous implementation was kind of clunky and didn't behave correct in most situations. A new resourcesPath configuration exists in the bundles rewriter which enforces a strict contract between the handler and your configuration, removing all assumptions.

Please refer to the below for how you should optimally setup your Vite configuration.

{
  base: command === 'build' ? '/etc.clientlibs/<project>/clientlibs/<clientlib>/' : '/',

  build: {
    rollupOptions: {
      output: {
        chunkFileNames: '<clientlib>/resources/js/chunks/[name].js',
        entryFileNames: '<clientlib>/resources/js/[name].js',
      },
    },
  },

  plugins: [
    bundlesImportRewriter({
      publicPath: '/etc.clientlibs/<project>/clientlibs/<clientlib>',
      resourcesPath: 'resources/js',
    }),
  ],
}
  • Vite 2.6.x and greater is now required

To keep up with internal fixes and feature additions Vite 2.6.x or greater is required to support server.origin which removes the need for the CSS Rewriter.

Readme

Source

AEM Vite logo


npm package node compatility Open in Visual Studio Code


@aem-vite/import-rewriter

A Vite/Rollup transformer that ensures dynamic import statements use the correct public path which by default is relative instead of absolute.

Getting Started

Please refer to aemvite.dev for some background and usage instructions.

License

Apache-2.0

Keywords

FAQs

Last updated on 12 Feb 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc