The production build in Settings
#The three main options have switches. Open the project menu, choose Settings…, and find Production build on the General page: Minify, Keep names and Tree shaking. The page says: "Applies to published and downloaded builds, not the live preview. Stored in playcode.config.json." A switch writes the file for you.
The file
#{
"esbuildProduction": {
"minify": true,
"keepNames": true,
"treeShaking": true
},
"esbuildDevelopment": {
"minify": false,
"keepNames": true,
"treeShaking": false
},
"loopProtection": true
}
These are the values Playcode uses when the file or a key is missing.
| Key | Values | Default | What it does |
|---|---|---|---|
esbuildProduction.minify |
true, false |
true |
Makes the published and downloaded code smaller |
esbuildProduction.keepNames |
true, false |
true |
Keeps function and class names readable in the published code. Turn it off only if nothing in your code depends on names |
esbuildProduction.treeShaking |
true, false |
true |
Drops code that nothing imports from the published code |
esbuildDevelopment.minify |
true, false |
false |
The same, for the preview |
esbuildDevelopment.keepNames |
true, false |
true |
The same, for the preview |
esbuildDevelopment.treeShaking |
true, false |
false |
The same, for the preview |
loopProtection |
true, false |
true |
Stops a loop in the preview after 1,500 iterations. The Loop protection switch in Settings writes it |
language |
javascript, python, c, cpp, go, sql |
javascript |
The language the project runs |
preset |
solid-js |
none | Compiles JSX for SolidJS |
After you edit the file
#| Option | When it takes effect |
|---|---|
esbuildProduction |
At your next publish or download |
esbuildDevelopment, loopProtection |
After you restart the preview: press Ctrl+Shift+R (Control+Shift+R on a Mac), or choose Stop, then Start Preview |
The switches in Settings restart the preview for you.
Messages
#| Message | Fix |
|---|---|
| "playcode.config.json is invalid. Please make sure it is correct JSON file." | The file is not valid JSON. Check its commas, quotes and braces |
| "playcode.config.json: Unknown keys: ... (typo?)" | The console names a key the editor does not know. Check its spelling |