1.4.1 • Published 4 years ago

@carv/snowpack-plugin-rollup v1.4.1

Weekly downloads
11
License
MIT
Repository
github
Last release
4 years ago

@carv/snowpack-plugin-rollup

Use rollup to bundle your application for production.

npm install --save-dev @carv/snowpack-plugin-rollup
// snowpack.config.json
{
  "plugins": ["@carv/snowpack-plugin-rollup"]
}

Features

  • CSS files are injected into the document head via a style tag.
  • Converts JSON files to ES6 modules.
  • Converts YAML files to ES6 modules.
  • All other imported files copied and are exported using the URL path.

    import img from './image.png' // img === 'http://host.name/assets/image-hash.png'

Default Build Script

{
  "scripts": {"bundle:*": "@carv/snowpack-plugin-rollup"}
}

Plugin Options

None

Generated Package Contents

DirectoryFormatTargetSveltepackage.json fieldUsed by
node/cjscjses2019dev: false, ssr: truemain && exports.requireNode.JS for Server Side Rendering
node/esmesmes2019dev: false, ssr: trueexports.defaultNode.JS for Server Side Rendering
node/jestcjses2019dev: trueexports.jestJest
browser/esnextesmesnextdev: falseesnextCarv CDN and specially configured bundlers
browser/es2015esmes2015dev: falsemoduleBundlers like rollup or CDN networks
browser/snowpackesmes2020dev: truebrowser:modulesnowpack.dev
typesesmesnexttypedtypesTypescript definitions

All assets are put into assets directory.

We are not using the svelte package.json field. This field is used by the rollup-plugin-svelte to transpile *.svelte files in node_modules. Furthermore this would require to copy the whole src directory. If any dependency uses a svelte preprocessor each project would need to setup svelte preprocess in the same way.