chore: remove old build step in react shim

This commit is contained in:
Josh Larson 2021-11-08 19:27:25 -06:00
parent 03232127c2
commit 075e9c1c18

View file

@ -1,6 +1,5 @@
import type {Plugin, ResolvedConfig} from 'vite';
import path from 'path';
import glob from 'fast-glob';
import {proxyClientComponent} from '../server-components';
export default () => {
@ -15,31 +14,6 @@ export default () => {
config = _config;
},
buildStart() {
if (config.build.ssr || config.command !== 'build') return;
const hydrogenComponentPath = path.dirname(
// eslint-disable-next-line node/no-missing-require
require.resolve('@shopify/hydrogen')
);
/**
* Grab each of the client components in this project and emit them as chunks.
* This allows us to dynamically import them later during partial hydration in production.
*/
const clientComponents = glob
.sync(path.resolve(config.root, './src/**/*.client.(j|t)sx'))
.concat(glob.sync(path.join(hydrogenComponentPath, '**/*.client.js')));
clientComponents.forEach((id) => {
this.emitFile({
type: 'chunk',
id,
preserveSignature: 'strict',
});
});
},
async resolveId(source, importer) {
if (!importer) return null;