安德魯·範·Slaars產生了很大的視頻我用上手Riot.js +的WebPack。
https://www.youtube.com/watch?v=UgdZbT-KPpY
他還提供了一個 「入門套件」 混帳回購與Riot.js +的WebPack:https://github.com/avanslaars/riot-webpack-base
兩者都是非常有益的,一個很好的起點。
package.json顯示需要什麼 - N.B.使用tag-loader而不是riotjs-loader。我發現標籤加載器爲我工作,所以沒有嘗試riotjs加載器。
{
"name": "riot-webpack-setup",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack-dev-server"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"riot": "^2.3.11"
},
"devDependencies": {
"babel-core": "^6.3.17",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"tag-loader": "^0.3.0",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0"
}
}
的webpack.config文件是相當簡單的開始:
var path = require('path')
module.exports = {
entry: './src/index.js',
output: {
path: __dirname,
filename: 'bundle.js'
},
module:{
loaders:[
{
test: /\.js$/,
loader:'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015']
}
},
{
test: /\.tag$/,
loader: 'tag',
exclude: /node_modules/
}
]
}
}
你試過[riotjs裝載機(https://www.npmjs.com/package/riotjs-loader)?它可能有幫助。 –