Plugin

Learn to create a bundler plugin to manage components.

We'll cover the following...

The bundler plugin

Popular JavaScript frameworks provide a convention for creating components. For example, some frameworks let developers define a new file with a specific extension dedicated to describing a component. This type of component is called SFC (Single File Component). To reproduce this feature we need to create a plugin that extends the module bundler and instruct it to manage those files with a specified extension. We use the following import statement for this:

import Example from "./components/Example.assma";

At this point, the module bundler should know how to deal with this type of file. Below is an example of a bundler plugin that works with Parcel. All we need to do is to ...