How to write a snabbdom loader in webpack.config.js -
i start work snabbdom
technology. binder, use projects, webpack. when try run project on node.js ('npm run build
'), shows me mistake:
error in ./app/main.js module parse failed: d:\user\webworkspace\snabbdom\snabbwebpack\app\main.js line 3: unexpected token may need appropriate loader handle file type. | "use strict"; | | import snabbdom 'snabbdom'; | import counter './counter'; |
are here know how write snabbdom loader in webpack.config.js file?
it's not snabbdom
, es2015 syntax. need babel-loader
:
npm install --save-dev babel-loader babel-core npm install babel-preset-es2015 --save-dev echo '{ "presets": ["es2015"] }' > .babelrc
and in webpack.config.js
:
module: { loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"} ] }
Comments
Post a Comment