Webpack import xxhash get an empty object
vaxilicaihouxian opened this issue · comments
CHENCHI MA commented
I use webpack2 and bower to install xxhash and use it in my app.js.But I got an empty Object.
import axios from 'axios';
import jQuery from 'jquery';
import xxhash from 'xxhash';
import fileuploader from './components/fileuploader';
console.log(xxhash );
Other library like axios,jquery that I loaded worked.
How can I use this xxhash lib in my app.js?
Pierre Curto commented
Hello,
It seems this was an issue with the webpack config in use.
It should work now.
CHENCHI MA commented
Package Updated?
CHENCHI MA commented
my index.js
import XXH from 'xxhash';
var h = XXH.h32( 'abcd', 0xABCD ).toString(16)
console.log(h);
my webpack.config.js
module.exports = {
entry: './index.js',
output: {
filename: './bundle.js'
},
resolve: {
modules: ["bower_components", "node_modules"],
descriptionFiles: ["bower.json"]
}
};
I use bower install the xxhash package.
λ bower install xxhash
bower xxhash#* cached https://github.com/pierrec/js-xxhash.git#0.2.1
bower xxhash#* validate 0.2.1 against https://github.com/pierrec/js-xxhash.git#*
bower xxhash#^0.2.1 install xxhash#0.2.1
Still not work.
Pierre Curto commented
Yeah the install via bower is still broken. My bower install is so I havent managed to update it yet.
In the meantime, you can get by by using the build/xxhash.js file.
I will work on my bower install meanwhile and update you.
CHENCHI MA commented
Got it.Thanks.