Skip to content

Commit

Permalink
switch to esm folder so that may avoid "mjs" extension which not all …
Browse files Browse the repository at this point in the history
…servers may support
  • Loading branch information
brettz9 committed Oct 8, 2024
1 parent cddec9a commit 99e075e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ docs/images/supporters
docs/api
mocha.js
mocha.js.map
mocha.mjs
mocha.mjs.map
esm/mocha.js
esm/mocha.js.map
esm/package.json
.karma/
!bin/mocha.js
!lib/mocha.js
Expand Down
2 changes: 1 addition & 1 deletion eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ module.exports = [
'test/integration/fixtures/**',
'.karma/**',
'mocha.js',
'mocha.mjs'
'esm/mocha.js'
],
}
];
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"node": ">= 14.0.0"
},
"scripts": {
"build": "rollup -c ./rollup.config.js",
"build": "rollup -c ./rollup.config.js && echo '{\"type\":\"module\"}' > esm/package.json",
"clean": "rimraf mocha.js mocha.js.map",
"docs-clean": "rimraf docs/_site docs/api",
"docs-watch": "eleventy --serve",
Expand Down Expand Up @@ -177,8 +177,9 @@
"mocha.css",
"mocha.js",
"mocha.js.map",
"mocha.mjs",
"mocha.mjs.map",
"esm/mocha.js",
"esm/mocha.js.map",
"esm/package.json",
"browser-entry.js"
],
"browser": {
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function getConfig (format) {
const config = {
input: './browser-entry.js',
output: {
file: `./mocha${format === 'esm' ? '.mjs' : '.js'}`,
file: format === 'esm' ? './esm/mocha.js' : './mocha.js',
format,
sourcemap: true,
name: 'mocha',
Expand Down
2 changes: 1 addition & 1 deletion test/browser-specific/fixtures/esm-build.fixture.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* eslint-disable-next-line import/no-absolute-path */
import mocha from '/base/mocha.mjs';
import mocha from '/base/esm/mocha.js';
window.MOCHA_IS_OK = true;
window.mocha = mocha;

0 comments on commit 99e075e

Please sign in to comment.