rollup-plugin-import-extendscript v1.1.2
rollup-plugin-import-extendscript
An experimental Vite / Rollup plugin to import ExtendScript files as a string
Installation
npm install rollup-plugin-import-extendscript --devSetup
When used with Vite, call the plugin in Vite's config instead of rollup's config to enjoy it during both development & bundling
import { defineConfig } from 'vite';
import importExtendScript from 'rollup-plugin-import-extendscript';
export default defineConfig({
plugins: [
importExtendScript()
]
});Rollup
import importExtendScript from 'rollup-plugin-import-extendscript';
export default {
plugins: [
importExtendScript()
]
};Usage
In your code, import the file as a string, then evaluate it
import jsxContent from './jsx/file.jsx';
new CSInterface().evalScript(jsxContent);The plugin will make sure that the file is loaded as a string, and that the string is properly escaped for ExtendScript.
Options
explicit
.jsx is not an extendscript exclusive file extension. To avoid clashes, you can set explicit to true and add a ?extendscript suffix to your import statements. For example:
In your config file:
importExtendScript({
explicit: true
})In your code:
import jsxContent from './jsx/file.jsx?extendscript';Files without the ?extendscript suffix will be ignored by the plugin.
Include
There are multiple ways to include a file in ExtendScript. This plugin knows how to handle the following two:
#include './other.jsx'Or
// @include './other.jsx'
š Good Boy Ninja