Skip to content

Commit

Permalink
fix: resolveLocal unexpectedly import cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengYuTay committed Jul 8, 2020
1 parent 9acaaf0 commit 02bd497
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/runtime-react/src/bundler/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import AliasPlugin from 'enhanced-resolve/lib/AliasPlugin';
import { PACKAGE_DIR } from '../paths';

export function config(api: IApi) {
const resolveLocal = (m: string) => require.resolve(m);
const resolveLocal = (m: string) =>
path.dirname(require.resolve(`${m}/package.json`));
const resolveUser = (m: string) =>
path.join(api.paths.rootDir, 'node_modules', m);
api.tap<APIHooks.IHookBundlerConfig>('bundler:configTarget', {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ReactRuntime implements Runtime.IRuntime<React.ComponentType<any>> {
local: 'dynamic'
});
api.addAppExport(
resolveDep('react-router-dom'),
'react-router-dom',
'{ Link, useLocation, useParams, useHistory, useRouteMatch, withRouter }'
);

Expand Down

0 comments on commit 02bd497

Please sign in to comment.