Categories JavaScript Answers How to import from root with JavaScript? Post author By John Au-Yeung Post date September 11, 2022 No Comments on How to import from root with JavaScript? Spread the love To import from root with JavaScript, we use ~. For instance, we write import 'foo' from '~/components/foo.js'; to use ~ as the alias for the root folder when using import to import the foo module. Related Posts How to conditionally import an ES6 module with JavaScript?Sometimes, we want to conditionally import an ES6 module with JavaScript. In this article, we'll… How to import module from URL with JavaScript?Sometimes, we want to import module from URL with JavaScript. In this article, we'll look… How to import jQuery using ES6 syntax with JavaScript?Sometimes, we want to import jQuery using ES6 syntax with JavaScript. In this article, we'll… By John Au-Yeung Web developer specializing in React, Vue, and front end development. View Archive → ← How to create an ISO date object in JavaScript? → How to write to stdin from an already initialized process with Nodejs Child Process? Leave a Reply Cancel replyYour email address will not be published. Required fields are marked *Comment * Name * Email * Website Save my name, email, and website in this browser for the next time I comment. Current ye@r * Leave this field empty