Skip to content

Commit

Permalink
fix: use mjs as file extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jason89521 authored and etrepum committed Mar 24, 2024
1 parent 0032c73 commit 4e225a1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ module.exports = {
},
{
// These aren't compiled, but they're written in module JS
files: ['packages/lexical-playground/esm/*.js'],
files: ['packages/lexical-playground/esm/*.mjs'],
parserOptions: {
sourceType: 'module',
},
Expand Down
18 changes: 9 additions & 9 deletions packages/lexical-playground/esm/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ <h4>Editor state:</h4>
<script type="importmap">
{
"imports": {
"lexical": "./dist/Lexical.esm.js",
"@lexical/clipboard": "./dist/LexicalClipboard.esm.js",
"@lexical/dragon": "./dist/LexicalDragon.esm.js",
"@lexical/history": "./dist/LexicalHistory.esm.js",
"@lexical/html": "./dist/LexicalHtml.esm.js",
"@lexical/rich-text": "./dist/LexicalRichText.esm.js",
"@lexical/selection": "./dist/LexicalSelection.esm.js",
"@lexical/utils": "./dist/LexicalUtils.esm.js"
"lexical": "./dist/Lexical.mjs",
"@lexical/clipboard": "./dist/LexicalClipboard.mjs",
"@lexical/dragon": "./dist/LexicalDragon.mjs",
"@lexical/history": "./dist/LexicalHistory.mjs",
"@lexical/html": "./dist/LexicalHtml.mjs",
"@lexical/rich-text": "./dist/LexicalRichText.mjs",
"@lexical/selection": "./dist/LexicalSelection.mjs",
"@lexical/utils": "./dist/LexicalUtils.mjs"
}
}
</script>
<script type="module" src="./index.esm.js"></script>
<script type="module" src="./index.mjs"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {HeadingNode, QuoteNode, registerRichText} from '@lexical/rich-text';
import {mergeRegister} from '@lexical/utils';
import {createEditor} from 'lexical';

import prepopulatedRichText from './prepopulatedRichText.esm.js';
import prepopulatedRichText from './prepopulatedRichText.mjs';

const editorRef = document.getElementById('lexical-editor');
const stateRef = document.getElementById('lexical-state');
Expand Down
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Object.keys(wwwMappings).forEach((mapping) => {
});

function getExtension(format) {
return `${format === 'esm' ? '.esm' : ''}.js`;
return `.${format === 'esm' ? 'm' : ''}js`;
}

async function build(name, inputFile, outputPath, outputFile, isProd, format) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/updateVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function updateVersion() {
}

function withEsmExtension(fileName) {
return fileName.replace(/\.js$/, '.esm.js');
return fileName.replace(/\.js$/, '.mjs');
}

function exportEntry(file) {
Expand Down

0 comments on commit 4e225a1

Please sign in to comment.