Skip to content

Commit

Permalink
Force CJS when importing emoji-regex module
Browse files Browse the repository at this point in the history
  • Loading branch information
yhatt committed Dec 11, 2022
1 parent b2beefb commit ae9f203
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion webpack.base.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ const { ESBuildMinifyPlugin } = require('esbuild-loader')

module.exports = ({ outputPath, production, minimizerFormat }) => ({
mode: production ? 'production' : 'none',
resolve: { extensions: ['.ts', '.js'] },
resolve: {
alias: {
// Marp Core (CJS) is not compatible with ESM default export
// https://github.com/marp-team/marp-core/issues/322
'emoji-regex$': require.resolve('emoji-regex/index.js'),
},
extensions: ['.ts', '.js'],
},
entry: `./src/${path.basename(outputPath, '.js')}.ts`,
output: {
filename: path.basename(outputPath),
Expand Down
1 change: 1 addition & 0 deletions webpack.web.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = (env) => {
...conf.resolve,
mainFields: ['browser', 'module', 'main'],
alias: {
...conf.resolve.alias,
[path.resolve(__dirname, './src/commands/export')]: path.resolve(
__dirname,
'./src/web/commands/export'
Expand Down

0 comments on commit ae9f203

Please sign in to comment.