为了账号安全,请及时绑定邮箱和手机立即绑定

刚开始是路径的问题,现在又是js的问题,太难了

gulpfile

http://img1.sycdn.imooc.com//5aa89d8e0001d42d05730505.jpg

webpack.config.js

http://img1.sycdn.imooc.com//5aa89db0000144c206030654.jpg

package.json

http://img1.sycdn.imooc.com//5aa89dcd0001a6b805410467.jpg

错误

http://img1.sycdn.imooc.com//5aa89ddd0001cdfd09660572.jpg

正在回答

3 回答

我的还发生错误了呢,求解不知道怎么修改了


webpack 是新版的,用视频的方法运行错误,所以修改如下,

module.exports = {

entry: {

index: './js/index'

},

output: {

filename: '[name].js'

},

resolve: {

extensions: ['.js']

},

module: {

rules: [{

test: /\.js$/,

exclude: /node_modules/,

use: [{

loader: 'babel',

options: {

presets: ['es2015']

}

}]

}]

}

}



错误如下:

λ gulp

[18:47:27] Using gulpfile F:\qianduan_dir\00program\JQuery\shudu\src\gulpfile.js

[18:47:27] Starting 'webpack'...

[18:47:32] Finished 'webpack' after 4.83 s

[18:47:32] Starting 'less'...

[18:47:33] Finished 'less' after 771 ms

[18:47:33] Starting 'default'...

[18:47:33] Finished 'default' after 86 μs


internal/streams/legacy.js:59

      throw er; // Unhandled stream error in pipe.

      ^

Error: Entry module not found: Error: Can't resolve 'babel' in 'F:\qianduan_dir\00program\JQuery\shudu\src'

BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.

                 You need to specify 'babel-loader' instead of 'babel',

                 see https://webpack.js.org/migrate/3/#automatic-loader-module-name-extension-removed

resolve 'babel' in 'F:\qianduan_dir\00program\JQuery\shudu\src'

  Parsed request is a module

  using description file: F:\qianduan_dir\00program\JQuery\shudu\src\package.json (relative path: .)

    resolve as module

      F:\qianduan_dir\00program\JQuery\shudu\node_modules doesn't exist or is not a directory

      F:\qianduan_dir\00program\JQuery\node_modules doesn't exist or is not a directory

      F:\qianduan_dir\00program\node_modules doesn't exist or is not a directory

      F:\node_modules doesn't exist or is not a directory

      looking for modules in F:\qianduan_dir\node_modules

        No description file found

      looking for modules in F:\qianduan_dir\00program\JQuery\shudu\src\node_modules

        using description file: F:\qianduan_dir\00program\JQuery\shudu\src\package.json (relative path: ./node_modules)

          using description file: F:\qianduan_dir\00program\JQuery\shudu\src\package.json (relative path: ./node_modules/babel)

            no extension

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel doesn't exist

        No description file found

            .js

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel.js doesn't exist

        no extension

          F:\qianduan_dir\node_modules\babel doesn't exist

            .json

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel.json doesn't exist

        .js

          F:\qianduan_dir\node_modules\babel.js doesn't exist

            as directory

              F:\qianduan_dir\00program\JQuery\shudu\src\node_modules\babel doesn't exist

        .json

          F:\qianduan_dir\node_modules\babel.json doesn't exist

        as directory

          F:\qianduan_dir\node_modules\babel doesn't exist


0 回复 有任何疑惑可以回复我~

解决了,谢谢,我的天,不仔细害死人啊

0 回复 有任何疑惑可以回复我~

presets 少了个s啊,大兄弟

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

刚开始是路径的问题,现在又是js的问题,太难了

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信