Skip to content

Commit a6da89d

Browse files
committed
docs(contribute): add note about commonjs support
1 parent c7091b3 commit a6da89d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/content/contribute/writing-a-loader.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,9 @@ T> If the language only accepts relative urls (e.g. `url(file)` always refers to
230230

231231
### Common Code
232232

233-
Avoid generating common code in every module the loader processes. Instead, create a runtime file in the loader and `import` it as a shared module:
233+
- Avoid generating common code in every module the loader processes. Instead, create a runtime file in the loader and `import` (or `require`) it as a shared module:
234+
235+
W> While CommonJS syntax (`require`) is completely supported, we highly recommend using ECMAScript Modules (`import`) for new loaders.
234236

235237
**src/loader-runtime.js**
236238

0 commit comments

Comments
 (0)