parcel-transformer-sveltejs v0.0.2
parcel-transformer-sveltejs
A Parcel 2 transformer for SvelteJS 3
Installation and usage
npm install --save-dev parcel-transformer-sveltejs
In Parcel 2 you need to tell Parcel which files to transform.
Put the following snippet in .parcelrc in the root of your app.
{
"extends": ["@parcel/config-default"],
"transforms": {
"*.svelte": ["parcel-transformer-sveltejs"]
}
}Configuration of Svelte compiler
You can configure the Svelte compiler through a config file .svelterc
or svelte.config.js at the project root level.
Optionally you can put a svelte field in package.json.
{
compiler: {
...options
}
}For details on compiler options, have a look in the Svelte compile docs.
Options set by the transformer
The three compiler options filename, name and dev are all set by
the transformer. Additionally the css option is set to false, as
recommended by Svelte, but you may override this.
Using preprocessors
Svelte supports running preprocessors to transform component source code.
You may pass the preprocessors argument to Svelte through a config file
svelte.config.js.
// This is just an example
const preprocessor = require('some-svelte-preprocessor');
module.exports = {
compiler: { ...options },
preprocessors: [
preprocessor
],
};For details on Svelte preprocessors, have a look in the Svelte preprocess docs.