✨ keith is
importing folders

Easy wildcard import with a babel plugin

2021 January 13th

Using snowpack

npm install @snowpack/plugin-babel snowpack-plugin-markdown @babel/preset-react snowpack

snowpack.config.json

json
{
"plugins": [
"@snowpack/plugin-babel",
"snowpack-plugin-markdown"
]
}

babel.config.json

json
{
"presets": [["@babel/preset-react"]],
"plugins": [
[
"wildcard",
{
"exts": ["md", "js", "jsx"]
}
]
]
}

Fill up ./items with a few markdown files

App.jsx

jsx
import * as Items from "./items";
home