Hello,
I have a webpack / reactjs project which runs without errors or issues. I’m having some trouble getting sparkjs included in the build. I’ve run
npm install --save spark
Then I’ve built a ParticleService
which basically abstracts the spark interface i.e. the following but with a few localStorage calls:
export default class ParticleService {
Login() { console.log("Logging in"); }
Logout() { console.log("Logging out"); }
}
As you can see it currently contains no sparkjs related code. When I add the line (or the equivalent require
)
import Spark from 'spark'
I get the following warning in my build log:
WARNING in ./~/spark/dist/spark.min.js
Critical dependencies:
1:113-120 This seems to be a pre-built javascript file. Though this is possible, it's not recommended. Try to require the original source to get better results.
@ ./~/spark/dist/spark.min.js 1:113-120
When I refresh the page I have an error:
Uncaught TypeError: Cannot read property 'call' of undefined
__webpack_require__ @ app.js:510
fn @ app.js:76
(anonymous function) @ spark.min.js:7
(anonymous function) @ spark.min.js:734
../lib/Promise @ spark.min.js:7
s @ spark.min.js:1
(anonymous function) @ spark.min.js:15
../device @ spark.min.js:1
s @ spark.min.js:1
(anonymous function) @ spark.min.js:14
.../vendor/jquery.modal.min.js @ spark.min.js:1
s @ spark.min.js:1
e @ spark.min.js:1
(anonymous function) @ spark.min.js:1
(anonymous function) @ spark.min.js:9
.... // so on
I’ve tried requiring the src files from the lib directory but they don’t build. Any hints?