Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpacks 打包好的asteroid,提示underfind #1

Open
marlti7 opened this issue Nov 8, 2016 · 3 comments
Open

webpacks 打包好的asteroid,提示underfind #1

marlti7 opened this issue Nov 8, 2016 · 3 comments

Comments

@marlti7
Copy link

marlti7 commented Nov 8, 2016

No description provided.

@marlti7
Copy link
Author

marlti7 commented Nov 8, 2016

引入路径没有问题

@leijing7
Copy link
Owner

https://github.com/Micjoyce/wechat-mina-ddp-example

There is another new and updated repo might help you.

@kedeng
Copy link

kedeng commented Apr 19, 2019

webpack的配置文件 libraryTarget:'commonjs2'
如果不设置这个,将不会导出任何函数。

  entry: './src/asteroid.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'asteroid.bundle.js',
    libraryTarget:'commonjs2'
  },
  devtool: 'source-map',
  mode: 'development',
};

另外asteroid还会有一个Websocket初始化的错误,解决方法是使用weapp.socket.io,
将SocketConstructor 设成 socketio

const socketio =  require("../webpacknpm/weapp.socket.io/dist/weapp.socket.io.js");
const asteroid = require("../webpacknpm/asteroid/dist/asteroid.bundle.js");


function initAsteroid(endPoint){
    const Asteroid = asteroid.createClass();
    // Connect to a Meteor backend
    const asteroidInst = new Asteroid({
      endpoint: endPoint,
      SocketConstructor: socketio
    });
    return asteroidInst;
}


module.exports = {
    initAsteroid
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants