我想做什么? 我想使用节点模块和 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
我的 whatchify 命令看起来像这样
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+node 代码所需的所有预设?我错过了什么?