Kind of embarrassing, but i'm trying to install Mithril following (hopefully) exactly how it's written on https://mithril.js.org/installation.html using "NPM Quick start with Webpack" and i'm always getting the same message:
md test1
cd test1
test1> npm install mithril --save
- [email protected]
added 1 package from 1 contributor in 1.007s
test1> npm install webpack --save
- [email protected]
added 295 packages from 269 contributors in 14.063s
Ops, first problem here, there is no package.json !
Let's create one:
test1> npm init --yes
Wrote to C:\Web\Mithril\test1\package.json:
And now add the lines:
{ ...
"scripts": {
"start": "webpack src/index.js bin/app.js --watch",
"test": "echo \"Error: no test specified\" && exit 1"
},
...
src/index.js fileOK (no lines of code written in it)
index.html file containing <script src="bin/app.js"></script>OK (just the "
@Kogumelo There's been some reports on the gitter chat about this, and FWICT some detail in the webpack setup has changed between version 4 and a previous version the guide was written against. Unfortunately I don't have an idea of how to fix it, as I don't use webpack.
If you're just looking to kick the tires rather than setting up a complete project, you could try something like f.e. https://flems.io/mithril which will set up a sandbox to play in.
Kind of disappointing that the installation guide is somehow outdated, but...
For start, I think https://flems.io/mithril will be OK. But for a complete project, what do you suggest instead?
And thanks for your answer!
Well, that is quite a broad question, considering how the javascript ecosystem works :) Any bundler you like should work, however if you're not familiar with them from before, note that 1) they're not strictly necessary, 2) they differ in how you configure them, 3) they're useful until they become sinkholes for time (some have inherent complexity gaps/learning curves). All that said, some popular choices beside webpack are
and there's a bunch of others. I've used webpack, browserify and rollup, and tend to reach for rollup out of familiarity and config preference.
If you're new to the tools, you could try searching for x-boilerplate projects or example setups, there's a lot of those, or try to adapt some example setups for other projects.
There's a few examples of other configurations than the website documentation here https://github.com/orbitbot/awesome-mithril
Swing by the chat if you're having issues, there's probably someone who can lend a hand sooner or later.
Sorry, site publishes have been low on the totem pole in terms of things I need to get done.
https://github.com/MithrilJS/mithril.js/blob/next/docs/installation.md
Has the latest (presumably working) version of those instructions. Webpack's been a bit of a moving target lately and most of the core contributors aren't using it, so it can definitely get busted from time to time :(
That's fine, I do understand. The thing is that the very second impression on Mithril (the first was what i've been reading about and it attracted me) gave me the sensation that, as newbies as me can't get it correctly installed, so it is a framework that is only for those who already knows it.
BTW,
https://github.com/MithrilJS/mithril.js/blob/next/docs/installation.md
is OK, i'm in!
Thank you!