Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export isDev const from solid-js/web #1577

Merged
merged 1 commit into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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