我想做什么?
我想使用节点模块和ES6 JavaScript语法创建一个项目。为了使它尽可能模块化和独立,我决定切换到watchify。
我的HTML页面看起来像这样
...some unrelated html code
<dib id='content'></div>
<script type='text/javascript' src='correct(checked) path to my bundle.js file'></script>
...some unrelated html code
我的调档命令是这样的
watchify src/app.js -o destination/bundle.js -t [babelify --presets [ es2015 ] ]
我的家属看起来像这样
"dependencies": {
"bluebird": "^3.5.1",
"jquery": "^3.3.1",
"three": "^0.92.0",
"three-obj-exporter": "0.0.1",
"three-obj-loader": "^1.1.3"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-core": "^6.26.3",
"babel-preset-env": "^1.6.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"babelify": "^8.0.0",
"nodemon": "^1.17.4"
}
目前,我的SRC文件中没有太多内容,我刚从test.js文件导入了一个测试函数,需要jquery。
import print from './taskobject';
function test(){
return 0;
}
我不明白什么?
实际上,我什么都不做,但我仍然在控制台中得到以下错误
GET blob:http://127.0.0.1/fbfa8eff-f538-42cf-aa2d-ae2940247aaf 0 ()
(anonymous) @ inject.preload.js:373
__webpack_require__ @ bootstrap a58e717ca664391e8660:19
splitSelector.splitSelector @ common.js:103
__webpack_require__ @ bootstrap a58e717ca664391e8660:19
exports.textToRegExp @ bootstrap a58e717ca664391e8660:62
(anonymous) @ bootstrap a58e717ca664391e8660:62
有问题吗?
我需要Webpack使用watchify/browserify吗?我是否使用了“编译”ES6+节点代码所需的所有预设?我错过了什么?