fgnass / spin.js

A spinning activity indicator
http://spin.js.org
MIT License
9.3k stars 1.02k forks source link

Loading path will be wrong when use es2015 babel by amd mode! #361

Closed varlinor closed 3 years ago

varlinor commented 5 years ago

I write a module that use Spin.js with es2015 syntax, when I babel script to es5 syntax, and load the module by requirejs, then the error will be throw like below:

GET http://localhost:63342/MyProject/test/spin.js 404 (Not Found)
# my entry file is in test dir; 

My project dir structure is like below:

project
-src
--module
--app.js
-dist
--module
--app-XXXX.js
-test
--require.config.js
--index.html
-vendor
--require
--jquery
--spin

this situation is caused by spin.js module name; the script after babel process will like below:

define(['exports', 'lodash', 'jquery', 'spin.js'], function (exports, _lodash, _jquery, _spin) {
    'use strict';
......

so, requirejs will load spin.js as a relative path based on index.html

Will you fix this bug sooner or later?

theodorejb commented 3 years ago

If a loader can't handle project names that contain a dot, that's a bug with the loader rather than the project.