Giter Club home page Giter Club logo

mpx's Issues

用cli生成的项目中,list组件未生成.json文件

用cli生成的项目在运行时报错
VM650:2 未找到 plugin.json 中的定义的 publicComponents "components/list491edbce/list" 对应的 JSON 文件
稍微追了一下,webpack-plugin/lib/json-compiler 文件25行
const rootName = this._compilation._preparedEntrypoints[0].name
来判断是否为app文件并不准确,导致在113行上判断
if (resourcePath === rootName)
时rootName与resourcePath相等了,同为组件名,从而未生成组件的json文件。
具体是哪次做了shift操作?还是组件进入队列的优先级变高了没往下追
是只有我才有的问题吗?
image

全局组件引入支持

在 app.mpx

<script type="application/json"> { "pages": [ "pages/index/index" ], "window": { }, "usingComponents": { } } </script>

引入全局组件支持

安装@mpxjs/cli失败

MacBook:~ zhanqi$ npm i -g @mpxjs/cli
npm ERR! Unexpected end of JSON input while parsing near '..."^1.0.0","xo":"*"},"d'

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhanqi/.npm/_logs/2019-04-17T03_06_58_812Z-debug.log

安装完脚手架,开发运行报错

webpack不是4.0以上吗?

WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

  • configuration has an unknown property '1'. These properties are valid:
    object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry?, externals?, loader?, mode?, module?, name?, node?, optimization?, output?, parallelism?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, serve?, stats?, target?, watch?, watchOptions? }
    For typos: please correct them.
    For loader options: webpack >= v2.0.0 no longer allows custom properties in configuration.
    Loaders should be updated to allow passing options via loader options in module.rules.
    Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
    plugins: [
    new webpack.LoaderOptionsPlugin({
    // test: /.xxx$/, // may apply this only for some modules
    options: {
    1: …
    }
    })
    ]
    at webpack (/Users/chason/Desktop/mpx/node_modules/webpack/lib/webpack.js:31:9)
    at runWebpack (/Users/chason/Desktop/mpx/build/build.js:30:5)
    at err (/Users/chason/Desktop/mpx/build/build.js:58:3)
    at afterGlob (/Users/chason/Desktop/mpx/node_modules/rimraf/rimraf.js:84:14)
    at f (/Users/chason/Desktop/mpx/node_modules/once/once.js:25:25)
    at Glob. (/Users/chason/Desktop/mpx/node_modules/glob/glob.js:151:7)
    at Glob.emit (events.js:182:13)
    at Glob._finish (/Users/chason/Desktop/mpx/node_modules/glob/glob.js:197:8)
    at done (/Users/chason/Desktop/mpx/node_modules/glob/glob.js:182:14)
    at Glob._processReaddir2 (/Users/chason/Desktop/mpx/node_modules/glob/glob.js:408:12)
    at /Users/chason/Desktop/mpx/node_modules/glob/glob.js:371:17
    at RES (/Users/chason/Desktop/mpx/node_modules/inflight/inflight.js:31:16)
    at f (/Users/chason/Desktop/mpx/node_modules/once/once.js:25:25)
    at Glob._readdirEntries (/Users/chason/Desktop/mpx/node_modules/glob/glob.js:578:10)
    at /Users/chason/Desktop/mpx/node_modules/glob/glob.js:555:12
    at FSReqWrap.oncomplete (fs.js:141:20)

sass-resources-loader没有效果

配置如下:

{
        test: /\.scss$/,
        use: [
          {loader: 'css-loader', options: {sourceMap: true}},
          {loader: 'sass-loader', options: {sourceMap: true}},
          {
            loader: 'sass-resources-loader',
            options: {
              sourceMap: true,
              resources: [
                resolve('src/styles/mixins.scss')
              ]
            }
          }
        ]
      }

在.mpx文件中和.scss文件中均无法找到mixins.scss文件中定义的function
求问这个是哪里配置错误了么?

px->rpx转换时的比例

建议在px转换rpx时在已有的基础上将数值*2

以iPhone6的375px为标准尺寸的宽的话,在转换成以750为宽的自适应单位rpx时,若数值不变直接转换单位,显示出的尺寸会很小。

ext.json和project.config.json能打包进dist吗

ext.json和project.config.json能打包进dist吗
虽然 ext.json需要生成小程序包的时候手动写入,但是在测试的时候每次npm run watch 都需要把文件复制进去 比较麻烦。

mpx文件中引入原生组件报错

image
image

无法引入原生小程序组件

jsEnginScriptError Component is not found in path "components/mpx-demo95b0aa24/src/components/test/test" (using by "pages/index");onAppRoute Error: Component is not found in path "components/mpx-demo95b0aa24/src/components/test/test" (using by "pages/index")

npm安装第三方组件项目,引用时候无法识别部分es6扩展运算符语法

npm安装第三方组件项目,引用时候无法识别部分es6扩展运算符语法,

以wux-weapp为例:
在index.mpx中引入
{ "navigationBarTitleText": "首页, "usingComponents": { "wux-filterbar": "../components/dist/filterbar" } }

在webpack.base.config.js中配置babel,在谷歌搜的解决办法

{ test: /\.js$/, loader: 'babel-loader', include: [ resolve('src'), resolve('test'), resolve('node_modules/@mpxjs'), resolve('node_modules/wux-weapp') ], options: { presets: ['env', 'es2015', 'react', 'stage-3'] } }

编译提示

./src/components/dist/checkbox-group/index.js (./node_modules/babel-loader/lib!./src/components/dist/checkbox-group/index.js)
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: E:/vueTest/5/demo-test/src/components/dist/checkbox-group/index.js: Unexpected token (46:42)

44 | },
45 | emitEvent(item) {
46 | this.triggerEvent('change', { ...item, name: this.data.name })
| ^
47 | },
48 | },
49 | })
@ ./src/components/dist/checkbox-group/index.js (./node_modules/@mpxjs/webpack-plugin/lib/native-loader.js!./src/components/dist/checkbox-group/index.js) 5:0-41 5:0-41

拷到src下面引入使用,正常编译无报错

希望增加alias支持

  {
    "usingComponents": {
      "list": "../components/list",
      "xx-button": "../../node_modules/xx-weapp/button/index"
    }
  }

如此引入非常不方便

外部引入的wxs会报错

在template里面引入

<wxs src="./../tools.wxs" module="tools" />

会报以下错误:

./../tools.wxs not found from ./pages/index/index.wxml

wx:if 中不能使用 WXS 模块的函数

模版

<view
  class="msg-time"
  wx:if="{{index === 0 || !utils.isSameMinute(item.msgTime, list[index - 1].msgTime)}}"
>
</view>

报如下错误

Expressions in wx:if/wx:elif/wx:for can not contain wxs module data.

mixins在传递对象数组时长度异常

版本:@mpxjs/core": "^1.1.0 "@mpxjs/webpack-plugin": "^1.1.0"
操作系统:windows10
浏览器:谷歌74.0.3702.0
问题描述:组件使用mixins引入时,定义在mixin.js中的数组对象,长度异常,原来写了3个对象,传递过去后数组对象的长度变为1000,其中前3个位正常数据,后面997个全部为undefined

// mixins.js代码
image

// component代码
image

异常结果:
image

控制台警告信息:
image

wx:model 双向绑定是不支持自定义组件吗?

我使用的是vant-weapp组件

<van-field
  id="phone"
  wx:model="{{ form.phone }}"
  label="手机号"
  placeholder="请输入手机号"
  error-message="手机号格式错误"
  border="{{ false }}"
/>

测试了一下,双向绑定不起作用,是我那里用得不对吗?

run watch 会出现问题

building...{ Error: ENOTEMPTY: directory not empty, rmdir 'D:\Office\project\wxck\dist\pages'
errno: -4051,
code: 'ENOTEMPTY',
syscall: 'rmdir',
path: 'D:\Office\project\wxck\dist\pages' }
| building...

这个问题必现,最新版本的

mpx 版本
"@mpxjs/core": "^1.0.26",
"@mpxjs/fetch": "^1.0.14",
"@mpxjs/promisify": "^1.0.14",
"@mpxjs/url-loader": "^1.0.15",
"@mpxjs/webpack-plugin": "^1.0.26",

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.