Skip to content

Commit

Permalink
feat(compass-web): create browser-compatible compass package COMPASS-…
Browse files Browse the repository at this point in the history
…7413 (#5249)

* feat(compass-web): create browser-compatible compass package

* chore(workspace): allow opening multiple tabs; handle namespaces in initial tabs

* chore(compass-web): add fonts and url handling in the sandbox

* chore(sidebar): adjust sidebar to work well in web environment

* chore(web): add rest of the plugins

* chore(webpack): move emotion server polyfill to the shared config

* chore(compass-web): depcheck fixes and very basic test setup

* chore: fix depalign

* chore(web): skip tests on rhel
  • Loading branch information
gribnoysup authored Dec 21, 2023
1 parent e03c6bc commit 3fc9e82
Show file tree
Hide file tree
Showing 44 changed files with 2,479 additions and 222 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function createEmotionServer() {
return {};
}
32 changes: 32 additions & 0 deletions configs/webpack-config-compass/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,21 @@ const sharedResolveOptions = (
// KeyObject instances from the Node.js crypto API (https://tinyurl.com/2rrtu2hy).
// Manually resolve `jose` to use the Node.js export here.
jose: require.resolve('jose'),

// Leafygreen tries to include all the server-side emotion stuff in the
// client bundle, this requires packaging a ton of otherwise unneccessary
// polyfills.To work around this, we're providing a minimally required
// polyfill for code not to break. This is mostly a problem for our web
// packages, but also not a bad thing at all for the electron app itself.
'@emotion/server/create-instance': path.resolve(
__dirname,
'..',
'polyfills',
'@emotion',
'server',
'create-instance',
'index.js'
),
},
};
};
Expand Down Expand Up @@ -321,6 +336,23 @@ export function createWebConfig(args: Partial<ConfigArgs>): WebpackConfig {
...sharedResolveOptions(opts.target),
},
ignoreWarnings: sharedIgnoreWarnings,
plugins:
isServe(opts) && opts.hot
? [
// Plugin types are not matching Webpack 5, but they work
new ReactRefreshWebpackPlugin() as unknown as WebpackPluginInstance,
]
: opts.analyze
? [
// Plugin types are not matching Webpack 5, but they work
new BundleAnalyzerPlugin({
logLevel: 'silent',
analyzerPort: 'auto',
}) as unknown as WebpackPluginInstance,

new DuplicatePackageCheckerPlugin(),
]
: [],
};
}

Expand Down
Loading

0 comments on commit 3fc9e82

Please sign in to comment.