![]() ![]() If you skipped the Introduction, we strongly recommend reading it before moving on to the rest of the documentation.All software, programs (including but not limited to drivers), files, documents, manuals, instructions or any other materials (collectively, “Content”) are made available on this site on an "as is" basis.Ĭanon Singapore Pte. If you are using VSCode, you can install the es6-string-html extension and prefix the strings with a /*html*/ comment to get syntax highlighting for them. You may have noticed that the imported component's template is inlined as a JavaScript string. ![]() You can also use any other HTTP server that can serve static files with the correct MIME types. To start a local HTTP server, first make sure you have Node.js installed, then run npx serve from the command line in the same directory where your HTML file is. In order for ES modules to work on our local machine, we need to serve the index.html over the protocol, with a local HTTP server. If you directly open the above index.html in your browser, you will find that it throws an error because ES modules cannot work over the file:// protocol, which is the protocol the browser uses when you open a local file.ĭue to security reasons, ES modules can only work over the protocol, which is what the browsers uses when opening pages on the web.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |