rollup-plugin-magic-string
string mutation plugin for rollup
Installing
# npm npm install -D rollup-plugin-magic-string # yarn yarn add -D rollup-plugin-magic-string
Usage
The default functionality gives you a magic-string object from the code of a module and allows you to perform any operations that magic-string supports.
Most often, you'll want to perform one of these very common operations. This module provides shortcut access to these, and thanks to magic-string, they are fully source-map supported.
Append: Append a string to the end of (a) module(s).
// ... rollup config here plugins:
Prepend: Prepends a string to (a) module(s).
// ... rollup config here plugins:
Wrap: Wraps the contents between two strings.
// ... rollup config here plugins:
Direct magic-string access
The above are useful shorthands, however as mentioned this plugin really gives you access to any operation that magic-string supports: