-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes for route boundaries, doc updates, various improvements to …
…architecture for css
- Loading branch information
1 parent
7e1d36a
commit 90c2feb
Showing
10 changed files
with
253 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
title: "Integration with Shopify Hydrogen and Oxygen" | ||
description: "Guide on getting remix-development-tools working with Shopify Hydrogen and Oxygen" | ||
--- | ||
|
||
## Adding remix-development-tools to your project | ||
|
||
Even though remix-development-tools is an ESM package, some of the dependencies it relies on are unfortunately not. This means that | ||
these dependencies will break the shopify CLI when running your Remix app built on top of Shopify Hydrogen and Oxygen. | ||
|
||
In case your package.json script `dev` command looks like this: | ||
|
||
```json | ||
"dev": "shopify hydrogen dev --codegen", | ||
``` | ||
|
||
This means you'll have to do the following to get it working. | ||
|
||
Go to your `vite.config.ts` and add `remix-development-tools`, depending on your project the file will look something like this: | ||
```diff | ||
import { defineConfig } from 'vite'; | ||
import { hydrogen } from '@shopify/hydrogen/vite'; | ||
import { oxygen } from '@shopify/mini-oxygen/vite'; | ||
import { vitePlugin as remix} from '@remix-run/dev'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
+ import { remixDevTools } from 'remix-development-tools'; | ||
export default defineConfig({ | ||
plugins: [ | ||
+ remixDevTools(), | ||
hydrogen(), | ||
oxygen(), | ||
remix({ | ||
presets: [hydrogen.preset()], | ||
future: { | ||
v3_fetcherPersist: true, | ||
v3_relativeSplatPath: true, | ||
v3_throwAbortReason: true, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
], | ||
build: { | ||
assetsInlineLimit: 0, | ||
}, | ||
ssr: { | ||
optimizeDeps: { | ||
include: [], | ||
}, | ||
}, | ||
}); | ||
|
||
``` | ||
## Adding problematic dependencies | ||
|
||
Add the following dependencies to `ssr.optimizeDeps.include` array: | ||
```diff | ||
export default defineConfig({ | ||
plugins: [ | ||
hydrogen(), | ||
oxygen(), | ||
remix({ | ||
presets: [hydrogen.preset()], | ||
future: { | ||
v3_fetcherPersist: true, | ||
v3_relativeSplatPath: true, | ||
v3_throwAbortReason: true, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
], | ||
build: { | ||
assetsInlineLimit: 0, | ||
}, | ||
+ ssr: { | ||
+ optimizeDeps: { | ||
+ include: [ | ||
+ 'react-use-websocket', | ||
+ 'beautify', | ||
+ 'react-diff-viewer-continued', | ||
+ 'react-d3-tree', | ||
+ ], | ||
+ }, | ||
+ }, | ||
}); | ||
``` | ||
|
||
### Debugging issues | ||
If you're still having issues, look at the error log output by the Shopify CLI and see if there are any errors related to the dependencies, the usual errors you might see are: | ||
- `require is not defined` | ||
- `module.exports is not defined` | ||
- `Cannot find module 'X'` | ||
|
||
This all indicated that there is a problem with a dependency that is used by remix-development-tools. Sometimes it's even a dependency not | ||
directly used by remix-development-tools, but it's a dependency of a dependency that is used by remix-development-tools. | ||
|
||
So if adding the first depedency in the error stack strace does not work, see if there are any additional dependencies in the stack trace before | ||
remix-development-tools. This package will be the last one in the stack trace. | ||
|
||
|
||
Enjoy your new remix-development-tools 🚀 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
title: "Integration with Shopify Hydrogen and Oxygen" | ||
description: "Guide on getting remix-development-tools working with Shopify Hydrogen and Oxygen" | ||
--- | ||
|
||
## Adding remix-development-tools to your project | ||
|
||
Even though remix-development-tools is an ESM package, some of the dependencies it relies on are unfortunately not. This means that | ||
these dependencies will break the shopify CLI when running your Remix app built on top of Shopify Hydrogen and Oxygen. | ||
|
||
In case your package.json script `dev` command looks like this: | ||
|
||
```json | ||
"dev": "shopify hydrogen dev --codegen", | ||
``` | ||
|
||
This means you'll have to do the following to get it working. | ||
|
||
Go to your `vite.config.ts` and add `remix-development-tools`, depending on your project the file will look something like this: | ||
```diff | ||
import { defineConfig } from 'vite'; | ||
import { hydrogen } from '@shopify/hydrogen/vite'; | ||
import { oxygen } from '@shopify/mini-oxygen/vite'; | ||
import { vitePlugin as remix} from '@remix-run/dev'; | ||
import tsconfigPaths from 'vite-tsconfig-paths'; | ||
+ import { remixDevTools } from 'remix-development-tools'; | ||
export default defineConfig({ | ||
plugins: [ | ||
+ remixDevTools(), | ||
hydrogen(), | ||
oxygen(), | ||
remix({ | ||
presets: [hydrogen.preset()], | ||
future: { | ||
v3_fetcherPersist: true, | ||
v3_relativeSplatPath: true, | ||
v3_throwAbortReason: true, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
], | ||
build: { | ||
assetsInlineLimit: 0, | ||
}, | ||
ssr: { | ||
optimizeDeps: { | ||
include: [], | ||
}, | ||
}, | ||
}); | ||
|
||
``` | ||
## Adding problematic dependencies | ||
|
||
Add the following dependencies to `ssr.optimizeDeps.include` array: | ||
```diff | ||
export default defineConfig({ | ||
plugins: [ | ||
hydrogen(), | ||
oxygen(), | ||
remix({ | ||
presets: [hydrogen.preset()], | ||
future: { | ||
v3_fetcherPersist: true, | ||
v3_relativeSplatPath: true, | ||
v3_throwAbortReason: true, | ||
}, | ||
}), | ||
tsconfigPaths(), | ||
], | ||
build: { | ||
assetsInlineLimit: 0, | ||
}, | ||
+ ssr: { | ||
+ optimizeDeps: { | ||
+ include: [ | ||
+ 'react-use-websocket', | ||
+ 'beautify', | ||
+ 'react-diff-viewer-continued', | ||
+ 'react-d3-tree', | ||
+ ], | ||
+ }, | ||
+ }, | ||
}); | ||
``` | ||
|
||
### Debugging issues | ||
If you're still having issues, look at the error log output by the Shopify CLI and see if there are any errors related to the dependencies, the usual errors you might see are: | ||
- `require is not defined` | ||
- `module.exports is not defined` | ||
- `Cannot find module 'X'` | ||
|
||
This all indicated that there is a problem with a dependency that is used by remix-development-tools. Sometimes it's even a dependency not | ||
directly used by remix-development-tools, but it's a dependency of a dependency that is used by remix-development-tools. | ||
|
||
So if adding the first depedency in the error stack strace does not work, see if there are any additional dependencies in the stack trace before | ||
remix-development-tools. This package will be the last one in the stack trace. | ||
|
||
|
||
Enjoy your new remix-development-tools 🚀 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.