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

二次开发说明 (基于 koa) #1

Closed
sorrycc opened this issue Apr 23, 2015 · 4 comments
Closed

二次开发说明 (基于 koa) #1

sorrycc opened this issue Apr 23, 2015 · 4 comments

Comments

@sorrycc
Copy link
Member

sorrycc commented Apr 23, 2015

var getWebpackOpts = require('spm-webpack').build.getWebpackOpts;
var webpack = require('spm-webpack').webpack;
var middleware = require('spm-webpack-server/middleware');
var app = require('koa'();

// 1. 获取 spm-webpack 处理过的参数
getWebpackOpts({cwd:cwd}, function(err, opts) {
  // do something with opts

  // 2. 获取 compiler 示例
  var compiler = webpack(opts);
  // do something with compiler

  // 3. 添加中间件到 koa
  app.use(middleware(compiler, opts);
});

@jsw0528

@antife-yinyue
Copy link
Contributor

👍

@xudafeng
Copy link

替换 serve-spm@sorrycc

@army8735
Copy link
Member

噢HOHO

@sorrycc
Copy link
Member Author

sorrycc commented Apr 24, 2015

@xudafeng 不是的,方案上次和 @jsw0528 沟通过了。简单说是 3.6 用 spm-webpack-server,3.6 以下用 serve-spm 。

@sorrycc sorrycc closed this as completed May 7, 2015
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

4 participants