MCPcopy Create free account
hub / github.com/TanStack/router / tanstackStart

Function tanstackStart

packages/solid-start/src/plugin/rsbuild.ts:12–84  ·  view source on GitHub ↗
(
  options?: TanStackStartRsbuildInputConfig,
)

Source from the content-addressed store, hash-verified

10import type { RsbuildPlugin } from '@rsbuild/core'
11
12export function tanstackStart(
13 options?: TanStackStartRsbuildInputConfig,
14): RsbuildPlugin {
15 const corePluginOpts: TanStackStartRsbuildPluginCoreOptions = {
16 framework: 'solid',
17 defaultEntryPaths: solidStartDefaultEntryPaths,
18 providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
19 ssrIsProvider: true,
20 rsbuild: {
21 environments: {
22 all: {
23 resolve: {
24 conditionNames: ['solid', '...'],
25 },
26 },
27 },
28 },
29 }
30
31 const basePlugin = tanStackStartRsbuild(corePluginOpts, options)
32
33 return {
34 name: 'tanstack-solid-start-rsbuild',
35 setup(api) {
36 basePlugin.setup(api)
37
38 api.modifyBundlerChain(async (chain, { CHAIN_ID, target }) => {
39 for (const ruleId of [
40 CHAIN_ID.RULE.JS,
41 CHAIN_ID.RULE.JS_DATA_URI,
42 'babel-js',
43 ]) {
44 if (!chain.module.rules.has(ruleId)) {
45 continue
46 }
47
48 const rule = chain.module.rule(ruleId)
49 if (!rule.uses.has(CHAIN_ID.USE.BABEL)) {
50 continue
51 }
52
53 rule.use(CHAIN_ID.USE.BABEL).tap((babelOptions) => {
54 if (typeof babelOptions === 'string') {
55 return babelOptions
56 }
57 babelOptions.presets = (babelOptions.presets ?? []).map(
58 (preset: unknown) => {
59 if (
60 Array.isArray(preset) &&
61 typeof preset[0] === 'string' &&
62 preset[0].includes('babel-preset-solid')
63 ) {
64 return [
65 preset[0],
66 {
67 ...(preset[1] ?? {}),
68 hydratable: true,
69 generate: target === 'node' ? 'ssr' : 'dom',

Callers 1

configureBabelFunction · 0.90

Calls 1

tanStackStartRsbuildFunction · 0.90

Tested by 1

configureBabelFunction · 0.72