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

来源:1-3 项目结构及前端构建技术

qq_是你的终究会来_0

2018-03-14 11:58

gulpfile

http://img4.mukewang.com/5aa89d8e0001d42d05730505.jpg

webpack.config.js

http://img1.mukewang.com/5aa89db0000144c206030654.jpg

package.json

http://img1.mukewang.com/5aa89dcd0001a6b805410467.jpg

错误

http://img1.mukewang.com/5aa89ddd0001cdfd09660572.jpg

写回答 关注

3回答

  • xiaomizhou66
    2018-11-02 19:21:42

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


    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


  • qq_是你的终究会来_0
    2018-03-26 17:07:57

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

  • 有些情入苦难回绵_9_03933931
    2018-03-20 21:01:23

    presets 少了个s啊,大兄弟

从JS到TS开发数独游戏(JS版)

使用JS语言为主的前端开发技术实现数独游戏

18162 学习 · 55 问题

查看课程

相似问题