Skip to content

Commit 4f8c498

Browse files
gjanblaszczykgkatsev
authored andcommitted
feat: add core ES module. (videojs#6287)
Allows you to do `import videojs from 'video.js/core.es.js';` to go along with `require('video.js/core.js')`;
1 parent f7b3772 commit 4f8c498

File tree

4 files changed

+20
-9
lines changed

4 files changed

+20
-9
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ es5/*
3434
.idea/
3535

3636
core.js
37+
core.es.js
3738

3839
# Ignore Chinese clones for now.
3940
lang/zh-Han*.json

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ dist/video-js-*.zip
55
!es5/**
66
!src/css/**
77
!core.js
8+
!core.es.js

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@
158158
"sandbox",
159159
"test/dist",
160160
"test/api",
161-
"core.js"
161+
"core.js",
162+
"core.es.js"
162163
]
163164
},
164165
"greenkeeper": {

rollup.config.js

+16-8
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,24 @@ export default cliargs => [
186186
onwarn,
187187
watch
188188
},
189-
// core
189+
// core cjs, es
190190
{
191191
input: 'src/js/video.js',
192-
output: {
193-
format: 'cjs',
194-
file: 'core.js',
195-
strict: false,
196-
banner,
197-
globals: globals.module
198-
},
192+
output: [
193+
{
194+
format: 'es',
195+
file: 'core.es.js',
196+
strict: false,
197+
banner,
198+
globals: globals.module
199+
}, {
200+
format: 'cjs',
201+
file: 'core.js',
202+
strict: false,
203+
banner,
204+
globals: globals.module
205+
}
206+
],
199207
external: externals.module,
200208
plugins: [
201209
json(),

0 commit comments

Comments
 (0)