Closed phra closed 6 years ago
Can you post your complete webpack config? This shouldn't be an issue if node_modules is excluded.
Cool, thanks! Do you use spin.js from npm or do you have a copy of spin.js in your app? And what error message do you get from webpack?
it's not finding the module because spin.js
triggers the regex: (or at least i think because aliases solved the problem)
loaders: [{
// JS LOADER
// Reference: https://github.com/babel/babel-loader
// Transpile .js files using babel-loader
// Compiles ES6 and ES7 into ES5 code
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}
Strange. If spin.js is installed via npm the exclude pattern should match (since spin.js will then be located under the node_modules folder) and the loader should be skipped.
it doesn't find spin.js
beacuse it's stripping the .js
and looking for a spin
module instead.
my alias restores the intended behavior.
I just cloned the angular-webpack
repo, did a npm i -S spin.js
, added import spin from 'spin.js';
to the app.js
file and run npm run build
without any errors. Could you provide a recipe to reproduce the error?
really strange. i will look into it.. thanks for the feedback.
I have a related problem with angular-spinner
which depends on spin.js
. My app is using webpack and it seems webpack uses AMD as standard module specification. The angular-spinner
AMD definition is:
define(['angular', 'spin'], factory);
So the webpack is looking for module spin
, instead of spin.js
. The workaround from @phra helped to make it working.
This might be the problem of angular-spiner
rather than spin.js
, just to note that.
me too i'm using angular-spinner
. let's open a ticket to them and reference it here.
hi,
webpack was failing bundling the code due to
spin.js
package name. to resolve i had to declare an alias section inwebpack.config.js
cheers.