Skip to content

Commit

Permalink
Merge 8a83011 into 31c455b
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Feb 23, 2023
2 parents 31c455b + 8a83011 commit 2b8819f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/thick-goats-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"solid-js": patch
---

Export `isDev` const from solid-js/web for differentiating between dev/prod env.
47 changes: 15 additions & 32 deletions packages/solid/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ const plugins = [
})
];

const replaceDev = isDev =>
replace({
'"_SOLID_DEV_"': isDev,
preventAssignment: true,
delimiters: ["", ""]
});

export default [
{
input: "src/index.ts",
Expand All @@ -43,13 +50,7 @@ export default [
format: "es"
}
],
plugins: [
replace({
'"_SOLID_DEV_"': false,
preventAssignment: true,
delimiters: ["", ""]
})
].concat(plugins)
plugins: [replaceDev(false)].concat(plugins)
},
{
input: "src/server/index.ts",
Expand Down Expand Up @@ -78,7 +79,7 @@ export default [
format: "es"
}
],
plugins
plugins: [replaceDev(true)].concat(plugins)
},
{
input: "store/src/index.ts",
Expand All @@ -93,13 +94,7 @@ export default [
}
],
external: ["solid-js"],
plugins: [
replace({
'"_SOLID_DEV_"': false,
preventAssignment: true,
delimiters: ["", ""]
})
].concat(plugins)
plugins: [replaceDev(false)].concat(plugins)
},
{
input: "store/src/server.ts",
Expand Down Expand Up @@ -129,7 +124,7 @@ export default [
}
],
external: ["solid-js"],
plugins
plugins: [replaceDev(true)].concat(plugins)
},
{
input: "web/src/index.ts",
Expand All @@ -144,13 +139,7 @@ export default [
}
],
external: ["solid-js"],
plugins: [
replace({
'"_DX_DEV_"': false,
preventAssignment: true,
delimiters: ["", ""]
})
].concat(plugins)
plugins: [replaceDev(false)].concat(plugins)
},
{
input: "web/server/index.ts",
Expand Down Expand Up @@ -180,7 +169,7 @@ export default [
}
],
external: ["solid-js"],
plugins
plugins: [replaceDev(true)].concat(plugins)
},
{
input: "universal/src/index.ts",
Expand All @@ -195,13 +184,7 @@ export default [
}
],
external: ["solid-js"],
plugins: [
replace({
'"_DX_DEV_"': false,
preventAssignment: true,
delimiters: ["", ""]
})
].concat(plugins)
plugins: [replaceDev(false)].concat(plugins)
},
{
input: "universal/src/index.ts",
Expand All @@ -216,7 +199,7 @@ export default [
}
],
external: ["solid-js"],
plugins
plugins: [replaceDev(true)].concat(plugins)
},
{
input: "html/src/index.ts",
Expand Down
3 changes: 2 additions & 1 deletion packages/solid/web/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export {
mergeProps
} from "solid-js";

export const isServer = true;
export const isServer: boolean = true;
export const isDev: boolean = false;

export function render() {}
export function hydrate() {}
Expand Down
1 change: 1 addition & 0 deletions packages/solid/web/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export {
export * from "./server-mock.js";

export const isServer: boolean = false;
export const isDev: boolean = "_SOLID_DEV_" as unknown as boolean;
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";

function createElement(tagName: string, isSVG = false): HTMLElement | SVGElement {
Expand Down

0 comments on commit 2b8819f

Please sign in to comment.