Skip to content

Integrated webpack 3 and vue and eggjs server for development and production.

Notifications You must be signed in to change notification settings

Stanlous/webpack-vue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

webpack-vue

Integrated webpack 3 and vue and eggjs server for development and production.

Setup

$ git clone https://github.com/Stanlous/webpack-vue.git
$ cd webpack-vue
$ npm install 

Usage

For development

$ npm run dev

Then http://127.0.0.1:8000 will be opened in browser automatically.

  • Add a page

static/pages.js

  module.exports = {
    ...
    another: 'another/index.js',
    ...
  }

server/app/route/index.js

  module.exports = {
    ...
    'GET /another': {
      template: 'another.html'
    },
    ...
  }

page another is served on http://127.0.0.1:8000/another

  • Add a service

server/app/route/index.js

  module.exports = {
    ...
    'POST /access_token': {
      controller: 'accessToken.index'
    },
    ...
  }

server/app/controller/access-token.js

  const Controller = require('egg').Controller
  module.exports = class AccessController extends Controller {
    async index() {
      //do what you want
    }
  }

service is served on http://127.0.0.1:8000/access_token

For production

npm run production

Server will be started at http://127.0.0.1:10010, set process.env.SERVER_PORT to specify server port. All static files include html css js will be built into directory public with content-hash.

Why not use Webpack4 ?

When I started this project, I used Webpack4 at first. But Webpack4 has a lot of bugs and is released frequently, it's unstable! After Webpack4 is stable, I will update to Webpack4.

Todo list

  • Source Map
  • SSR
  • CLI
  • Many others

License

MIT

About

Integrated webpack 3 and vue and eggjs server for development and production.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published