1.0.21 • Published 1 year ago

vite-plugin-factory v1.0.21

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

vite-plugin-factory

Wraps the content of a file in a factory function

Usage

The plugin is a raw object

import factoryPlugin from "vite-plugin-factory";
import { defineConfig } from "vite";

export default defineConfig({
    plugins: [ factoryPlugin ]
    // ...
});

Result

The factory takes one function named __import that will be responsible for resolving other imports. For example this:

import { $TRACK } from "solid-js"; // (Random example)

export const UNDEFINED = console.log($TRACK);

export default UNDEFINED;

Becomes this:

export default (async __import => {
  const {
    $TRACK
  } = await __import("solid-js");
  const UNDEFINED = console.log($TRACK);
  return {
    UNDEFINED,
    default: UNDEFINED
  };
});
1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago