I am attempting to run a hello world application using cycle.js with webpack 2.2.1.
The following error is being displayed:
ERROR in ./app/index.js Module not found: Error: Can't resolve '@cycle/run' in '/Users/Ben/proj/sb_vol_calc/frontend/app' @ ./app/index.js 7:11-32 @ multi webpack-dev-server/client?http://localhost:3000 ./app/index
Shown below is the content of my webpack.config.js file:
var path = require('path')
var webpack = require('webpack')
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'./app/index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader'
}
}
]
},
resolve: {
extensions: ['.js'],
modules: [
path.join(__dirname, 'src'),
"node_modules"
]
}
}
Next is my package.json configuration:
{
"name": "xxx",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "node server.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"babel": {
"presets": [
"es2015",
"react",
"stage-0"
]
},
"devDependencies": {
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.23.0",
"babel-preset-stage-0": "^6.22.0",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
},
"dependencies": {
"@cycle/dom": "^14.3.0",
"@cycle/xstream-run": "^4.2.0",
"xstream": "^10.2.0"
}
}
After running npm install, I expected it to work smoothly. Am I overlooking something?
And lastly, here's a snippet from index.js:
import xs from 'xstream';
import {run} from '@cycle/run';
import {makeDOMDriver, h1} from '@cycle/dom';
function main() {
const sinks = {
DOM: xs.periodic(1000).map(i =>
h1('' + i + ' seconds elapsed')
)
};
return sinks;
}
const drivers = {
DOM: makeDOMDriver('#root')
};
run(main, drivers);