Skip to content

Commit d233c9f

Browse files
committed
fix: es6m build now contains .mjs extension for local imports/exports
1 parent 4704acd commit d233c9f

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

packages/casl-prisma/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ Want to file a bug, contribute some code, or improve documentation? Excellent! R
199199

200200
If you'd like to help us sustain our community and project, consider [to become a financial contributor on Open Collective](https://opencollective.com/casljs/contribute)
201201

202-
> See [Support CASL](https://casl.js.org/v5/en/support-casljs) for details
202+
> See [Support CASL](https://casl.js.org/v5/en/support-casljs) for details.
203203
204204
## License
205205

packages/dx/config/rollup.config.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ import sourcemaps from 'rollup-plugin-sourcemaps';
55
import { dirname, basename, extname } from 'path';
66
import babelConfig from './babel.config';
77

8+
function extensionify(options) {
9+
return {
10+
name: 'extensionify',
11+
renderChunk(code) {
12+
return code.replace(/((?:import|export)[^}]+\}\s+from\s+)(['"])(\.\/[^'"]+)/g, (_, importedPackage, quote, packageName) => {
13+
return `${importedPackage}${quote}${packageName}${options.ext}`;
14+
});
15+
}
16+
}
17+
}
18+
819
const output = (config) => {
920
let prop = 'dir';
1021
let path = `dist/${config.id}${config.subpath}`;
@@ -35,9 +46,6 @@ const build = config => ({
3546
keep_classnames: /Ability|ForbiddenError/,
3647
mangle: {
3748
properties: {
38-
reserved: [
39-
'_collection',
40-
],
4149
regex: /^_[a-z]/i
4250
},
4351
},
@@ -46,6 +54,9 @@ const build = config => ({
4654
defaults: false,
4755
}
4856
})
57+
: null,
58+
config.ext
59+
? extensionify({ ext: config.ext })
4960
: null
5061
]
5162
},
@@ -75,7 +86,7 @@ function parseOptions(overrideOptions) {
7586
useInputSourceMaps: !!process.env.USE_SRC_MAPS,
7687
minify: process.env.NODE_ENV === 'production' && process.env.LIB_MINIFY !== 'false',
7788
transformJS: process.env.ES_TRANSFORM !== 'false',
78-
plugins: []
89+
plugins: [],
7990
};
8091

8192
if (overrideOptions.input) {

0 commit comments

Comments
 (0)