Git Product home page Git Product logo

vue-vuex-starter-kit's Introduction

Vue Vuex Starter Kit

整合Vue + Vuex + Vue-Router。内置webpack配置,基于Koajs搭建开发服务框架,内置基本挡板中间件。 可以方便快速搭建自己的vuex应用程序。

开始

如果你的开发环境符合版本要求,你可以用下面的步骤安装和启动项目。

$ git clone https://github.com/sokis/vue-vuex-starter-kit.git 
$ cd vue-vuex-starter-kit
$ npm install                   # 安装依赖
$ npm start                     # 编译及启动

如果一切正常,你将看到如下界面:

通常在开发中,主要使用npm start 来启动项目. 但是,这里也有提供你使用的其他Npm 脚本

npm run <script> 描述
start 启动App 本地开发服务,该环境下HMR也将运行。 localhost:3000.
compile 编译App到dist目录 (默认情况下在~/dist).
dev npm start
dev:mock npm run dev,但是会加载mocking中间件
dev:no-debug npm run dev,但是会禁用控制台输出
test 运行Karma单元测试,并生成coverage代码覆盖测试
test:dev npm run test,但会开启代码监控。并且不会生成代码覆盖测试
deploy 运行测试,并且生成编译后的代码
deploy:dev deploy,但是环境变量 NODE_ENV 为 "development".
deploy:prod deploy,但是环境变量 NODE_ENV 为 "production".
lint Lint all .js files.
lint:fix Lint and fix all .js files. Read more on this.

目录结构

.
├── config                   # vuex-cli-webpack 配置文件
├── src                      # 源码
└── tests                    # 单元测试

src 目录

src
├── components              # 公用组件
├── containers
├── layouts                 # 此处定义页面骨架组件
│   └── CoreLayout
├── routes                  # 路由及子路由配置
│       └── routes          
├── static
├── styles
└── store
    ├── constants
    └── plugins

routes 目录下面加入 modules 目录用于存放vuex 相关模块文件

src/routes
├── Counter
│   ├── components
│   └── modules
├── Home
│   ├── assets
│   └── components
└── User
    ├── components
    └── routes
        └── Login
            ├── components
            └── modules

备注

该工程,可以用 vuex-cli 快速创建。

感谢

"Vuex CLI Webpack" "React Redux Starter Kit"

vue-vuex-starter-kit's People

Contributors

sokis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vue-vuex-starter-kit's Issues

Cannot resolve module 'vuex' in

编译报错

➜  vue-vuex-starter-kit git:(next) npm install
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated [email protected]: 'postcss-cssnext' has been deprecated in favor of 'postcss-preset-env'. Read more at https://moox.io/blog/deprecating-cssnext/
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
WARN notice [SECURITY] mime has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=mime&version=1.3.6 - Run `npm i npm@latest -g`to upgrade your npm version, and then `npm audit` to get more info.
WARN notice [SECURITY] handlebars has the following vulnerability: 1 high. Go here for more details: https://nodesecurity.io/advisories?search=handlebars&version=1.3.0 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.
WARN notice [SECURITY] uglify-js has the following vulnerability: 2 low. Go here for more details: https://nodesecurity.io/advisories?search=uglify-js&version=2.3.6 - Run `npm i npm@latest -g` to upgrade your npm version, and then `npm audit` to get more info.

> [email protected] install /Users/weisd/project/weisd/vue-vuex-starter-kit/node_modules/fsevents
> node install

[fsevents] Success: "/Users/weisd/project/weisd/vue-vuex-starter-kit/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> [email protected] postinstall /Users/weisd/project/weisd/vue-vuex-starter-kit/node_modules/nodemon
> node bin/postinstall || exit 0

Love nodemon? You can now support the project via the open collective:
 > https://opencollective.com/nodemon/donate

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of vuex@^2.0.0-rc.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint-plugin-standard@>=2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of vue-hot-reload-api@^1.2.0 but none is installed. You must install peer dependencies yourself.

added 1226 packages in 181.284s
➜  vue-vuex-starter-kit git:(next) ✗ npm start

> [email protected] start /Users/weisd/project/weisd/vue-vuex-starter-kit
> better-npm-run start

running better-npm-run in /Users/weisd/project/weisd/vue-vuex-starter-kit
Executing script: start

to be executed: ./node_modules/.bin/vuex-webpack-server
  app:config Creating default configuration. +0ms
  app:config Looking for environment overrides for NODE_ENV "development". +4ms
  app:config Found overrides, applying to default configuration. +0ms
  app:config Load config : /Users/weisd/project/weisd/vue-vuex-starter-kit/config/development.conf +1ms
  app:webpack:config Package "vuex" was not found as an npm dependency in package.json; it won't be included in the webpack vendor bundle. Consider removing it from vendor_dependencies in~/config/index.js +2ms
  app:webpack:config Create configuration. +1s
  app:webpack:config Enable plugins for live development (HMR, NoErrors). +2ms
  app:config Load config : /Users/weisd/project/weisd/vue-vuex-starter-kit/config/webpack.config +5ms
  app:server:error Enable error middleware. +47ms
koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.mdnode_modules/vuex-cli-webpack/lib/server/main.js:78:5
  app:server:webpack-dev Enable webpack dev middleware. +30ms
  app:server:webpack-hmr Enable Webpack Hot Module Replacement (HMR). +17ms
  app:bin:server Server is now running at http://192.168.1.102:3000. +8ms
  app:bin:server Server accessible via localhost:3000 if you are using the project defaults. +0ms

src/styles/app.css
undefined [undefined]
undefined [undefined]

webpack built c34104e799be140b2a93 in 5391ms
Hash: c34104e799be140b2a93
Version: webpack 1.15.0
Time: 5391ms
                             Asset     Size  Chunks       Chunk Names
    vendor.c34104e799be140b2a93.js   480 kB       6       vendor
     src/styles/fonts/iconfont.ttf  11.2 kB
       1.1.c34104e799be140b2a93.js  12.3 kB       1
       2.2.c34104e799be140b2a93.js  4.27 kB       2
       3.3.c34104e799be140b2a93.js  1.43 kB       3
       4.4.c34104e799be140b2a93.js  2.38 kB       4
       5.5.c34104e799be140b2a93.js  1.37 kB       5
       app.c34104e799be140b2a93.js   610 kB       0       app
   app.c34104e799be140b2a93.js.map   777 kB       0       app
   1.1.c34104e799be140b2a93.js.map  14.8 kB       1
   2.2.c34104e799be140b2a93.js.map   6.8 kB       2
   3.3.c34104e799be140b2a93.js.map  2.24 kB       3
   4.4.c34104e799be140b2a93.js.map  3.26 kB       4
   5.5.c34104e799be140b2a93.js.map   2.1 kB       5
vendor.c34104e799be140b2a93.js.map   573 kB       6       vendor

ERROR in multi vendor
Module not found: Error: Cannot resolve module 'vuex' in /Users/weisd/project/weisd/vue-vuex-starter-kit
 @ multi vendor

ERROR in ./src/store/index.js
Module not found: Error: Cannot resolve module 'vuex' in /Users/weisd/project/weisd/vue-vuex-starter-kit/src/store
 @ ./src/store/index.js 11:12-27

ERROR in ./src/store/plugins/index.js
Module not found: Error: Cannot resolve module 'vuex/dist/logger' in /Users/weisd/project/weisd/vue-vuex-starter-kit/src/store/plugins
 @ ./src/store/plugins/index.js 7:14-41

ERROR in ./~/babel-loader/lib?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./~/eslint-loader!./src/routes/Counter/components/CounterView.vue
Module not found: Error: Cannot resolve module 'vuex' in /Users/weisd/project/weisd/vue-vuex-starter-kit/src/routes/Counter/components
 @ ./~/babel-loader/lib?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./~/eslint-loader!./src/routes/Counter/components/CounterView.vue 11:12-27

ERROR in ./~/babel-loader/lib?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./~/eslint-loader!./src/routes/User/routes/List/components/ListView.vue
Module not found: Error: Cannot resolve module 'vuex' in /Users/weisd/project/weisd/vue-vuex-starter-kit/src/routes/User/routes/List/components
 @ ./~/babel-loader/lib?presets[]=es2015&plugins[]=transform-runtime&comments=false!./~/vue-loader/lib/selector.js?type=script&index=0!./~/eslint-loader!./src/routes/User/routes/List/components/ListView.vue 11:12-27
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks       Chunk Names
    index.html  20.8 kB       0
webpack: Failed to compile.

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.