Help us understand the problem. What is going on with this article?

【Riot.js】【訂正版】cdnで楽々Hello World

Riot.jsの勉強をしています。
npmやwebpackを使う方法もあるのですが、より簡単なcdnを使う方法で学習を進めていきます。

まずは、任意のフォルダにindex.htmlapp.riotを用意します。

index.html
<!doctype html>

<html>
  <head>
    <title>Riot todo</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
  </head>

  <body>

    <app></app>

    <script src="app.riot" type="riot"></script>
    <script src="https://cdn.jsdelivr.net/npm/riot@4/riot+compiler.min.js"></script>

    <script>
      riot.compile().then(() => {
        riot.mount('app', {
          title: 'Hello World',
        })
      })
    </script>
  </body>
</html>
app.riot
<app>
  <h3>{ props.title }</h3>
</app>

このままhtmlファイルをchromeにおくと、URL scheme must be "http" or "https" for CORS request.といったエラーが出てしまうので、以下の手順でローカルサーバーを立てます。

$ npm install -g live-server
$ cd <index.htmlとapp.riotがあるフォルダ>
$ live-server .
# http://localost:8080/でブラウザからアクセス可能

これで画面にHello Worldと表示されます!!

[参考]
https://github.com/riot/examples
ChromeにてAjaxでローカルファイルにアクセス

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした