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

Fix webpack missing exports warnings #1582

Merged
merged 3 commits into from
Jan 20, 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
8 changes: 5 additions & 3 deletions packages/toolpad-app/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export default withSentryConfig(
// Ignoring type mismatch because types from Sentry are incompatible
// https://github.com/getsentry/sentry-javascript/issues/4560
webpack: (config, options) => {
config.resolve = config.resolve ?? {};
config.resolve ??= {};
config.resolve.fallback = {
...config.resolve.fallback,
// We need these because quickjs-emscripten doesn't export pure browser compatible modules yet
Expand All @@ -136,6 +136,9 @@ export default withSentryConfig(
path: false,
};

config.module ??= {};
config.module.strictExportPresence = true;

if (!USE_EXPERIMENTAL_TRANSPILE_PACKAGES) {
// Support global CSS in monaco-editor
// Adapted from next-transpile-modules.
Expand All @@ -144,8 +147,7 @@ export default withSentryConfig(
path.resolve(path.dirname(require.resolve('monaco-editor/package.json')), './esm'),
];

config.module = config.module ?? {};
config.module.rules = config.module.rules ?? [];
config.module.rules ??= [];
const nextCssLoaders = /** @type {import('webpack').RuleSetRule} */ (
config.module.rules.find(
(rule) => typeof rule === 'object' && typeof rule.oneOf === 'object',
Expand Down
Loading