Git Product home page Git Product logo

Comments (9)

sky-admin avatar sky-admin commented on August 18, 2024

发下你的webpack config?cli创建项目时是一路回车下来的吗?

from mpx.

hiyuki avatar hiyuki commented on August 18, 2024

检查一下是不是手动往配置里敲了一个‘1’,脚手架生成的配置中不应该存在这种属性

from mpx.

loo41 avatar loo41 commented on August 18, 2024
  • 项目运行报错
  • 模板配置错了
  • 数组和对象 merge 成了下标对象这种形式去了
function runWebpack (cfg) {
  if (program.production || program.watch) {
    cfg = merge(cfg, program.production ? {
      mode: 'production'
    } : {
      cache: true
    })
  }
  if (process.env.npm_config_report) {
    var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
    var mainCfg = Array.isArray(cfg) ? cfg[0] : cfg
    mainCfg.plugins.push(new BundleAnalyzerPlugin())
  }
  if (program.watch) {
    【console.log(cfg)】
    webpack(cfg).watch({}, callback)
  } else {
    webpack(cfg, callback)
  }
}

得到

{ '0':
   { module: { rules: [Array] },
     output:
      { filename: '[name].js',
        path: 'D:\\桌面-copy\\mpxtest\\dist\\plugin' },
     optimization: { runtimeChunk: [Object], splitChunks: [Object] },
     mode: 'none',
     plugins: [ [Object] ],
     resolve: { extensions: [Array], modules: [Array] },
     entry: { plugin: 'D:\\桌面-copy\\mpxtest\\src\\plugin\\plugin.json' } },
  '1':
   { module: { rules: [Array] },
     output:
      { filename: '[name].js',
        path: 'D:\\桌面-copy\\mpxtest\\dist\\miniprogram' },
     optimization: { runtimeChunk: [Object], splitChunks: [Object] },
     mode: 'none',
     plugins: [ [Object], [Object] ],
     resolve: { extensions: [Array], modules: [Array] },
     entry: { app: 'D:\\桌面-copy\\mpxtest\\src\\miniprogram\\app.mpx' } },
  cache: true }

from mpx.

nan1010082085 avatar nan1010082085 commented on August 18, 2024

npm run watch报错了? 为啥npm run build命令是好的呢

from mpx.

nan1010082085 avatar nan1010082085 commented on August 18, 2024

@sky-admin @loo41 大佬有正确的模版配置吗

from mpx.

loo41 avatar loo41 commented on August 18, 2024

因为build并没有执行这个

 cfg = merge(cfg, program.production ? {
      mode: 'production'
    } : {
      cache: true
    })

from mpx.

nan1010082085 avatar nan1010082085 commented on August 18, 2024

我重新下生成了一下项目 发现 一路回车 在plugins 插件这个选项的时候选择 no 生成的命令
也就是不是插件模式 npm run warch 就没问题

from mpx.

sky-admin avatar sky-admin commented on August 18, 2024

已复现问题,正在解决,正常开发需求一般应该选择非插件模式,我们默认提供的选项也是No。。

from mpx.

sky-admin avatar sky-admin commented on August 18, 2024

已解决。重新init项目即可。
已有项目的修改可参见:mpx-ecology/mpx-template@5d8ce0c

from mpx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.