File tree 2 files changed +28
-3
lines changed
2 files changed +28
-3
lines changed Original file line number Diff line number Diff line change 3
3
"version" : " 5.0.0-alpha.1" ,
4
4
"description" : " Selectors for Redux." ,
5
5
"main" : " ./dist/cjs/reselect.cjs" ,
6
- "module" : " ./dist/reselect.mjs " ,
6
+ "module" : " ./dist/reselect.legacy-esm.js " ,
7
7
"types" : " ./dist/reselect.d.ts" ,
8
8
"exports" : {
9
9
"./package.json" : " ./package.json" ,
Original file line number Diff line number Diff line change @@ -18,19 +18,19 @@ export default defineConfig(options => {
18
18
entry : {
19
19
reselect : 'src/index.ts'
20
20
} ,
21
+ sourcemap : true ,
21
22
...options
22
23
}
23
24
24
25
return [
26
+ // Modern ESM
25
27
{
26
28
...commonOptions ,
27
29
format : [ 'esm' ] ,
28
30
outExtension : ( ) => ( { js : '.mjs' } ) ,
29
31
dts : true ,
30
32
clean : true ,
31
33
async onSuccess ( ) {
32
- // Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
33
- fs . copyFileSync ( 'dist/reselect.mjs' , 'dist/reselect.legacy-esm.js' )
34
34
console . log ( 'onSuccess' )
35
35
36
36
console . log ( 'Generating TS 4.6 types...' )
@@ -42,6 +42,31 @@ export default defineConfig(options => {
42
42
console . log ( 'TS 4.6 types done' )
43
43
}
44
44
} ,
45
+
46
+ // Support Webpack 4 by pointing `"module"` to a file with a `.js` extension
47
+ // and optional chaining compiled away
48
+ {
49
+ ...commonOptions ,
50
+ entry : {
51
+ 'reselect.legacy-esm' : 'src/index.ts'
52
+ } ,
53
+ format : [ 'esm' ] ,
54
+ outExtension : ( ) => ( { js : '.js' } ) ,
55
+ target : 'es2017'
56
+ } ,
57
+ // Browser-ready ESM, production + minified
58
+ {
59
+ ...commonOptions ,
60
+ entry : {
61
+ 'reselect.browser' : 'src/index.ts'
62
+ } ,
63
+ define : {
64
+ 'process.env.NODE_ENV' : JSON . stringify ( 'production' )
65
+ } ,
66
+ format : [ 'esm' ] ,
67
+ outExtension : ( ) => ( { js : '.mjs' } ) ,
68
+ minify : true
69
+ } ,
45
70
{
46
71
...commonOptions ,
47
72
format : 'cjs' ,
You can’t perform that action at this time.
0 commit comments