Problems with webpack
I'm using webpack to load modules and using Firepad's Headless npm module. When I import as such:
import Firepad from 'firepad';
const headless = new Firepad.Headless('https://myrefhere.firebaseio.com');
The module it shows two errors:
Critical dependencies:
14:3292-3299 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/firepad/dist/firepad.min.js 14:3292-3299
Critical dependencies:
2463:61-68 require function is used in a way in which dependencies cannot be statically extracted
@ ./~/firepad/dist/firepad.js 2463:61-68
I also can't use it within a React callback function. The function doesn't call the callback.
headless.setText(content, (err, committed) => {
console.log(err, committed); // not called
})
@cameronroe The warnings and headless not working for you may be unrelated. I have received the same warnings while still getting everything to function correctly.
Things To Try
- Make sure your rules allow you to do this write operation
- Try passing a ref to Firepad instead of your url (i.e
firebase.initializeApp(config);
const headless = new Firepad.Headless(firebase.database.ref.child('yourChild'));
Webpack Sidenote
I also needed the expose loaded to get Codemirror working with Firepad in Webpack like so:
require('expose?CodeMirror!codemirror') // Needed for Firepad to load CodeMirror
Hello,
I have encountered the same error. It can be easily reproduced by creation new angular project with firepad. It looks like firepad can't be used anymore.
I am curious if someone managed to solve this somehow.
@zeratulinio Did you try the solution I posted? Still currently using this config and it is working for me.
I have it functionally working as well, but it would be nice to setup Angular application in the way it doesn't show any warniings. @prescottprue @zeratulinio anyone has solution that would remove the warning?
@opensso You can try adding firepad to the noParse options of webpack (i.e. do not send it through the loaders at all), but that broke stuff I was trying to use it with.
There is also a way to silence webpack warnings, but I enjoy other warnings so I don't want them gone all together.