Best way to handle commonjs conditional re-exports?
              
              #952
            
            -
| 
         I am trying to use  Based on #922 it would appear this is related to how the package is bundled, is there a way I can force the use of the  I tried using   | 
  
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| 
         Sure, easiest would be to use  // wmr.config.mjs
import { defineConfig } from 'wmr';
import replace from '@rollup/replace-plugin';
// Full list of options: https://wmr.dev/docs/configuration
export default defineConfig({
	/* Your configuration here */
	alias: {
		react: 'preact/compat',
		'react-dom': 'preact/compat'
	},
        plugins: [
                replace({ 'use-sync-external-store/shim/index.js': 'preact/compat' }),
        ],
});This (more or less) directly swaps string values. A bit less refined than an alias, but still very effective (and necessary in this case). Hope it helps!  | 
  
Beta Was this translation helpful? Give feedback.
Sure, easiest would be to use
@rollup/replace-plugin. Just install it and modify yourwmr.config.mjsto look a little like the following:This (more or less) directly swaps string values. A bit less refined than an alias, but still very effective (and necessary in this case).
Hope i…