Trying to import moment.js as an es6 module. Latest Chrome version is being used.
Based on the discussion here, I tried the src path (es6)
import * as moment from './node_modules/moment/src/moment'
While skipping the .js seem to work fine for everyone on that thread, I can't get it to work. But this works
import * as moment from './node_modules/moment/src/moment.js'
Yet the request ultimately fails with all the moment import trying to load its dependencies without the js extension
GET http://127.0.0.1:8083/node_modules/moment/src/lib/utils/hooks net::ERR_ABORTED 404 (Not Found) moment.js:22
GET http://127.0.0.1:8083/node_modules/moment/src/lib/moment/moment net::ERR_ABORTED 404 (Not Found) moment.js:26
GET http://127.0.0.1:8083/node_modules/moment/src/lib/moment/calendar net::ERR_ABORTED 404 (Not Found) moment.js:39
GET http://127.0.0.1:8083/node_modules/moment/src/lib/locale/locale net::ERR_ABORTED 404 (Not Found) moment.js:46
GET http://127.0.0.1:8083/node_modules/moment/src/lib/duration/duration net::ERR_ABORTED 404 (Not Found) moment.js:48
GET http://127.0.0.1:8083/node_modules/moment/src/lib/units/units net::ERR_ABORTED 404 (Not Found) moment.js:50
GET http://127.0.0.1:8083/node_modules/moment/src/lib/utils/is-date net::ERR_ABORTED 404 (Not Found)
All I have as code is a blank index.html with this script tag
<script type="module" src='./main.js'></script>
and a main.js file with this
import * as _ from './node_modules/underscore/underscore.js';
import * as moment from './node_modules/moment/src/moment.js';
Underscore.js imports and works fine. Issue is only with moment. What am I doing wrong? Also why is it that I can't get either of these to load without specifying the .js extension while clearly those on the ithub thread have been able to do this
import * as moment from 'moment'