JavaScript Tutorial

How To Fix Uncaught ReferenceError: require is not defined In Browser Side Javascript Code

I have 2 js files and 1 Html file. I import the 2 js files into the Html file. In the js file, I use the method require() to include other js files or modules. And when I browse the Html file in a web browser, It shows the error message Uncaught ReferenceError: require is …

How To Fix Uncaught ReferenceError: require is not defined In Browser Side Javascript Code Read More »

How To Use Babel To Fix ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’

When I run the command browserify ./js/test1.js -o build.js in the terminal to bundle some js files into one, it throws the error message like ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’. This article will tell you how to fix it using babel to transcompile the js file source code to ES …

How To Use Babel To Fix ParseError: ‘import’ and ‘export’ may appear only with ‘sourceType: module’ Read More »

How To Fix Error: Can’t walk dependency graph: Cannot find module from When Run Browserify

When I open a terminal and run the command browserify ./lib/test1.js -o build.js to bundle the file ./lib/test1.js and all it’s dependent js module files into the build.js file, I meet the error Can’t walk dependency graph: Cannot find module ‘core-js/modules/es.array.iterator.js’ from ‘. This article will tell you how to fix this error.

How To Define ES6 Javascript Module And Call Module Exported Function In Html Code Correctly

I have a js file in my example project. And I define a js module function and a variable in the js file source code that uses the ES6 syntax. But when I want to use the module function and variable in an Html file, it throws some errors. This article will tell you how …

How To Define ES6 Javascript Module And Call Module Exported Function In Html Code Correctly Read More »