fgnass / spin.js

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

Spinner not working in IE11 & Firefox with angular #345

Closed Chi1985 closed 6 years ago

Chi1985 commented 6 years ago

Hi, I'm using Spin.js in angular application to show spinner on button click. It is working fine in chrome but not in IE11 and firefox. If i open the url "http://spin.js.org/" in IE or firefox it is loading the spinner. Should i make any config changes while using it in angular app?

theodorejb commented 6 years ago

If you are using spin.js v3, you'll need to use a module bundler like Rollup or Webpack to support Firefox and IE, since they don't support native ES6 modules.

Chi1985 commented 6 years ago

I'm getting the following error when i try to to bundle my main.ts file using rollup

src/main.ts → build/js/main.min.ts... [!] Error: Could not resolve './app/app.module' from src\main.ts Error: Could not resolve './app/app.module' from src\main.ts at error (C:\Users\3094\AppData\Roaming\npm\node_modules\rollup\dist\rollup.js:185:14) at then.resolvedId (C:\Users\3094\AppData\Roaming\npm\node_modules\rollup\dist\rollup.js:16011:8) at process._tickCallback (internal/process/next_tick.js:109:7) at Module.runMain (module.js:606:11) at run (bootstrap_node.js:383:7) at startup (bootstrap_node.js:149:9) at bootstrap_node.js:496:3

my rollup.config.js

export default { entry: 'src/main.ts', dest: 'build/js/main.min.ts', format: 'iife', sourceMap: 'inline', };

copy of my main.ts file

import { enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module'; import { environment } from './environments/environment'; import{Spinner} from 'spin.js';

if (environment.production) { enableProdMode(); }

platformBrowserDynamic().bootstrapModule(AppModule);

"import { AppModule } from './app/app.module';" corresponds to ./app/app.module.ts file It would be great if somebody can tell me how to bundle' ts ' file or any workaround for this?

or should i use 'spin.js' as entry in my rolllup.config.js file? if so what should be the full path for spin.js

theodorejb commented 6 years ago

That error doesn't have anything to do with spin.js. If you have issues with Rollup and TypeScript, I'd recommend searching for a tutorial on how to use them together, or asking on Stack Overflow.