Skip to content

Commit

Permalink
Fix webpack 3 async imports
Browse files Browse the repository at this point in the history
  • Loading branch information
marcodejongh authored and conorhastings committed Oct 22, 2018
1 parent c9ce284 commit 3c3bc0a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/light-async.js
Expand Up @@ -4,5 +4,8 @@ export default createAsyncLoadingHighlighter({
supportsLanguageRegistering: true,
loader: () => import(
/* webpackChunkName:"react-syntax-highlighter/lowlight-import" */
'lowlight/lib/core').then(({ default: lowlight }) => lowlight),
'lowlight/lib/core').then((module) => {
// Webpack 3 returns module.exports as default as module, but webpack 4 returns module.exports as module.default
return module.default || module;
}),
});
5 changes: 4 additions & 1 deletion src/prism-async-light.js
Expand Up @@ -4,5 +4,8 @@ export default createAsyncLoadingHighlighter({
supportsLanguageRegistering: true,
loader: () => import(
/* webpackChunkName:"react-syntax-highlighter/refractor-core-import" */
'refractor/core').then(({ default: refractor }) => refractor),
'refractor/core').then((module) => {
// Webpack 3 returns module.exports as default as module, but webpack 4 returns module.exports as module.default
return module.default || module;
}),
});
5 changes: 4 additions & 1 deletion src/prism-async.js
Expand Up @@ -3,5 +3,8 @@ import createAsyncLoadingHighlighter from './async-syntax-highlighter';
export default createAsyncLoadingHighlighter({
loader: () => import(
/* webpackChunkName:"react-syntax-highlighter/refractor-import" */
'refractor').then(({ default: refractor }) => refractor),
'refractor').then((module) => {
// Webpack 3 returns module.exports as default as module, but webpack 4 returns module.exports as module.default
return module.default || module;
}),
});

0 comments on commit 3c3bc0a

Please sign in to comment.