parcel-plugin-wrapper
Q:What is this thing solving?
Tiny Parcel plugin that wraps output files with custom text or code.
This plugins imitates pretty much what wrapper-webpack-plugin does.
Install
yarn add parcel-plugin-wrapper --dev
Usage
Create a .assetWrapper.js
file in the root folder of your project.
Example 1, add some data coming from package.json:
const path = const CWD = processconst PACKAGE = const yourAssetProcess = async { // name = app.ere76r5e76r5e76r.js if name === 'js' && bundleroptionsproduction return header: `/* - */` footer: `// The End.` } moduleexports = yourAssetProcess
Will output:
/* your-project - 3.4.56 */{var i="function"==typeof parcelRequireetcetcetc......bla...bla...bla// The End
Example 2, Wraps bundle files with '.js' extension in a self invoking function and enables strict mode:
const path = const yourAssetProcess = { if name === 'js' && bundleroptionsproduction return header: '(function () { "use strict";\n' footer: '\n})();' } moduleexports = yourAssetProcess
Maintainers
Contribute
PRs accepted.
License
MIT © 2018 Albino Tonnina