Webpack installation - es6 - javascript

I am an es6 newbie!
When all webpack installation were done, I started trying to create some files as in the pic
and then i tried to write some code in index.js and checked whether it run or not using command
npm run build
and it ended up with a bunch of errors like the pic below
I've been searching a while to resolve this prob but I still cant find out how to solve it.
Plz give me some suggestions to save my day.
I really appreciate your comments!

agree with Andrew Li.
You also need to write some run script in your package.json if you want to use npm command

Related

How to install brain.js on Mac?

I need help with downloading brain.js in to VS Code. I have looked on YouTube and Stack Overflow for answers, nevertheless I could not find any solution. I hope so one can describe me what to do.
Open command prompt in the folder with the program and type
npm install --save brain.js
In the node.js program, put
const brain = require("brain.js");
If that doesnt work, go to the website and you might find something there, or i found this good video. the video

does not provide an export named 'BrowserQRCodeReader'

I am using zxing-js/library library for qr code reading. I am facing a strange issue. The code for the qr scanning works in stackblitz online sample code, but not in my local environment.
I am getting this error in local environment on run time. The compilation proceeds successfully.
Uncaught SyntaxError: The requested module '/node_modules/#zxing/library/esm5/index.js' does not provide an export named 'BrowserQRCodeReader'
stackblitz link
github link
It seems like the zxing-js/library has issues with bundling.
I can reproduce the error by running npm run build, followed by npm run start.
Looks like some bundling would be required for you to get this working in the browser. See this post for more info
In the meantime, you can use npm run start:dev, and you will be able to do local development as expected.
Thanks #passle_ from the #open-wc team for helping with this.
In addition to jlengrands answer, npm start will start the owc-dev-server which does a minimal amount of work; it'll only resolve the bare modules.
The QR code library that you're trying to use uses commonjs, it'll need a little magic to be transformed so the browser can understand that code. The webpack-dev-server can do this for you, which you can run with npm run start:dev.

how to use complexity-report tool on a js project

I have installed complexity-report on a javascript project
Instalation is done using $ npm install complexity-report on the root directory of the project. I can run $ cr and it shows some configuration options like on the image above here.
What i don't know is which command i have to use or what steps i have to follow to calculate for example the complexity of a specific js folder?
I need some help with a description of how to use this tool. Some explanations of that tool are given here but i don't understand which is the next step to follow in my case.
Thanks in advance

Netbeans project - Node.js: Node must be a valid file

I’ve just created my first Node.js application in Netbeans. I mean, this is a brand new project. I haven't done anything and I’m already getting an error. Maybe there is a step to configure this or a file to create or something to install but I've googled for information to no avail. I guess this is just too basic, because I couldn’t find anything out there to help.
What does this mean and how can I fix it?
Duh! I found it. For some reason the Node path and the npm path were defaulting to Program Files (x86) and nodejs was installed in Program Files. I feel dumb.
Plus, as soon as I fixed it, all other new projects were fixed.

JSDoc setting up?

I am not that good at computers but am trying to use JSDoc for one of my projects,
The tutorial to get it up and running is here
http://usejsdoc.org/about-jsdoc3.html
I have downloaded the program from github, but now do not understand what I have to do. I have a bunch of files in a folder and dont know how to get it actually running for my project.
Could someone please give me a step by step instruction on how to actually get JSDoc working, how do I set it up, how do I use it etc.
I know this may be mundane to some of you, but hey we all gotta start somewhere right?
Well, are you using windows or GNU/Linux?
First, you have to follow the default tags to markup your source code, identifying your classes, methods, parameters, etc...
After that, you download the file here: https://github.com/jsdoc3/jsdoc
Extract it and then go to folder jsdoc-master.
Inside it, you have a script called jsdoc (with no extension). Only you have to do is execute it pointing the whole path to your .js file you want to create a documentation like this: ./jsdoc your_class.js
Then, in a couple minutes you'll have the output inside the 'out' folder. Open the .html file and bang! You have your documentation working pretty good.
Right here you can find some common tags to use in your code (as comments): http://usejsdoc.org/
This solution is for Unix based system. But, there is another one using nodejs (that you can run with windows, Linux, mac, etc...). First, download the nodejs here: http://nodejs.org/
Then go to this website to take a look at the package jsdoc: https://npmjs.org/
Then, go back to your terminal (in any operating system after installed node) and type: npm install -g jsdoc
The option -g means globally, so you have inside the main folder of your node packages and they are available for whatever project you have and you don't need to install it again and again...
Finally, you can just use this command: jsdoc path/to/your/file.js
And that's it! I hope it helps you.
Once you've extracted the file you downloaded off of github, navigate within the folder and run in a terminal:
./jsdoc
with the options you want.
If you want to display the help menu
./jsdoc --help
If you want to install the program on your system, assuming a mac or linux machine, use root user or sudo:
npm install --save -g [~/Downloads/jsdoc-3.2.2 or your path to the downloaded extracted files]

Categories

Resources