webpack
A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
Top Related Projects
🛠️ webpack-based tooling for Vue.js Development
Set up a modern web app by running one command.
CLI tool for Angular
Template for building basic applications with Svelte
😺 Your next Preact PWA starts in 30 seconds.
Create and build modern JavaScript projects with zero initial configuration.
Quick Overview
The vuejs-templates/webpack repository is a template for Vue.js projects using webpack as the build tool. It provides a pre-configured development environment for building single-page applications with Vue.js, including hot-reload, linting, testing, and CSS extraction.
Pros
- Pre-configured webpack setup, saving time on initial project setup
- Includes hot-reload for faster development
- Integrated testing setup with Jest
- Optimized production build process
Cons
- May be overwhelming for beginners due to its complexity
- Requires understanding of webpack for customization
- Some configurations may become outdated as Vue.js and webpack evolve
- Limited flexibility compared to setting up a project from scratch
Getting Started
-
Install Vue CLI if you haven't already:
npm install -g @vue/cli
-
Create a new project using the webpack template:
vue init webpack my-project
-
Navigate to the project directory and install dependencies:
cd my-project npm install
-
Start the development server:
npm run dev
Your Vue.js application will now be running at http://localhost:8080
.
Competitor Comparisons
🛠️ webpack-based tooling for Vue.js Development
Pros of vue-cli
- More modern and actively maintained
- Offers a wider range of features and customization options
- Provides an interactive project creation process
Cons of vue-cli
- Steeper learning curve for beginners
- May include unnecessary features for simple projects
- Requires more configuration for advanced setups
Code Comparison
vue-cli:
vue create my-project
cd my-project
npm run serve
webpack:
vue init webpack my-project
cd my-project
npm run dev
Key Differences
- vue-cli uses a plugin-based architecture, allowing for more flexibility
- webpack template is simpler but less feature-rich
- vue-cli supports modern JavaScript features out of the box
- webpack template requires manual updates for newer Vue versions
Use Cases
vue-cli
- Large-scale applications
- Projects requiring extensive customization
- Teams familiar with modern build tools
webpack
- Quick prototypes
- Simple single-page applications
- Learning Vue.js basics
Community Support
- vue-cli has more active development and frequent updates
- webpack template is no longer actively maintained
- vue-cli has a larger community and more resources available
Performance
- vue-cli generally offers better build performance
- webpack template may require manual optimization for larger projects
Conclusion
While the webpack template is simpler and easier for beginners, vue-cli is the recommended choice for most new Vue.js projects due to its active development, extensive features, and better long-term support.
Set up a modern web app by running one command.
Pros of create-react-app
- Easier setup and configuration out of the box
- More active development and community support
- Better documentation and extensive ecosystem
Cons of create-react-app
- Less flexibility in configuration options
- Larger bundle size due to included dependencies
- Steeper learning curve for customizing the build process
Code Comparison
create-react-app:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
webpack:
import Vue from 'vue';
import App from './App.vue';
new Vue({
el: '#app',
render: h => h(App)
});
Summary
create-react-app provides a more streamlined setup process for React projects, with better documentation and community support. However, it offers less flexibility in configuration compared to webpack.
webpack allows for more customization but requires more manual setup. It's generally lighter-weight but may require more time to configure properly.
Both tools serve their respective frameworks well, with create-react-app being more opinionated and webpack offering more flexibility. The choice between them often depends on the specific project requirements and developer preferences.
CLI tool for Angular
Pros of angular-cli
- More comprehensive tooling and CLI commands for Angular development
- Built-in support for testing, including unit and end-to-end tests
- Stronger typing system with TypeScript integration
Cons of angular-cli
- Steeper learning curve due to Angular's complexity
- Larger bundle size and potentially slower initial load times
- More opinionated structure, which may limit flexibility for some projects
Code Comparison
angular-cli component generation:
ng generate component my-component
webpack template component creation:
# Manual file creation required
touch MyComponent.vue
Additional Notes
- angular-cli provides a more complete development ecosystem out of the box
- webpack template offers more flexibility but requires manual setup for advanced features
- angular-cli enforces TypeScript usage, while webpack template allows choice between JavaScript and TypeScript
- Both tools support hot module replacement and efficient build processes
- webpack template may be easier for beginners to understand and customize
Overall, angular-cli is better suited for large-scale Angular applications, while the webpack template is more flexible for smaller Vue.js projects or those requiring custom configurations.
Template for building basic applications with Svelte
Pros of template
- Simpler setup and configuration out of the box
- Faster compilation and smaller bundle sizes due to Svelte's approach
- More straightforward component structure with less boilerplate
Cons of template
- Smaller ecosystem and community compared to Vue.js
- Less mature tooling and third-party library support
- Steeper learning curve for developers coming from traditional frameworks
Code Comparison
template (Svelte):
<script>
let count = 0;
function increment() {
count += 1;
}
</script>
<button on:click={increment}>
Clicks: {count}
</button>
webpack (Vue.js):
<template>
<button @click="increment">
Clicks: {{ count }}
</button>
</template>
<script>
export default {
data() {
return { count: 0 }
},
methods: {
increment() {
this.count++
}
}
}
</script>
The Svelte example demonstrates its more concise syntax and reactive declarations, while the Vue.js example showcases its component structure with separate template and script sections. Svelte's approach results in less boilerplate code, but Vue.js offers a more familiar structure for developers coming from other frameworks.
😺 Your next Preact PWA starts in 30 seconds.
Pros of preact-cli
- Smaller bundle size and faster performance due to Preact's lightweight nature
- Built-in progressive web app (PWA) support with service worker generation
- Simpler setup and configuration process for quick project initialization
Cons of preact-cli
- Less extensive ecosystem and community support compared to Vue.js
- Fewer built-in features and components out of the box
- Limited template options and customization compared to webpack template
Code Comparison
preact-cli:
import { h, render } from 'preact';
const App = () => <h1>Hello, World!</h1>;
render(<App />, document.body);
webpack:
import Vue from 'vue';
import App from './App.vue';
new Vue({
render: h => h(App)
}).$mount('#app');
Summary
preact-cli offers a lightweight and fast alternative to the webpack template, with built-in PWA support and a simpler setup process. However, it lacks the extensive ecosystem and customization options provided by the Vue.js webpack template. The code comparison shows the difference in syntax and initialization between Preact and Vue.js projects.
Create and build modern JavaScript projects with zero initial configuration.
Pros of Neutrino
- More flexible and customizable build configuration
- Supports multiple frameworks and libraries beyond Vue.js
- Offers a plugin-based architecture for easier extensibility
Cons of Neutrino
- Steeper learning curve for beginners
- Less Vue.js-specific optimizations out of the box
- Requires more setup and configuration for Vue.js projects
Code Comparison
Neutrino configuration:
module.exports = {
use: [
'@neutrinojs/vue',
'@neutrinojs/jest',
neutrino => {
neutrino.config.module.rule('style').use('postcss').options({
plugins: [require('tailwindcss'), require('autoprefixer')]
});
}
]
};
webpack template configuration:
module.exports = {
configureWebpack: {
plugins: [
new VueLoaderPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV)
}
})
]
}
};
The Neutrino configuration demonstrates its plugin-based approach and flexibility, while the webpack template shows a more Vue.js-specific setup. Neutrino allows for easier integration of additional tools like Jest and PostCSS, whereas the webpack template provides a more streamlined configuration for Vue.js projects out of the box.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
vue-webpack-boilerplate
A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.
This template is Vue 2.0 compatible. For Vue 1.x use this command:
vue init webpack#1.0 my-project
Vue-cli 3 is here, so this template is now considered deprecated.
This template was the main template for vue-cli verison 2.*.
Now that we have released a stable version of vue-cli 3, which incorporates all features that this template offers (and much more), we think that this template doesn't have any significant use for the future, so we won't put much resource in developing it further.
We will try and fix major issues should they arise, but not much more.
Feel free to fork this template if you want to keep it alive.
Documentation
- For this template: common questions specific to this template are answered and each part is described in greater detail
- For Vue 2.0: general information about how to work with Vue, not specific to this template
Usage
This is a project template for vue-cli. It is recommended to use npm 3+ for a more efficient dependency tree.
$ npm install -g vue-cli
$ vue init webpack my-project
$ cd my-project
$ npm install
$ npm run dev
This will scaffold the project using the master
branch. If you wish to use the latest version of the webpack template, do the following instead:
$ vue init webpack#develop my-project
:warning: The develop branch is not considered stable and can contain bugs or not build at all, so use at your own risk.
The development server will run on port 8080 by default. If that port is already in use on your machine, the next free port will be used.
What's Included
-
npm run dev
: first-in-class development experience.- Webpack +
vue-loader
for single file Vue components. - State preserving hot-reload
- State preserving compilation error overlay
- Lint-on-save with ESLint
- Source maps
- Webpack +
-
npm run build
: Production ready build.- JavaScript minified with UglifyJS v3.
- HTML minified with html-minifier.
- CSS across all components extracted into a single file and minified with cssnano.
- Static assets compiled with version hashes for efficient long-term caching, and an auto-generated production
index.html
with proper URLs to these generated assets. - Use
npm run build --report
to build with bundle size analytics.
-
npm run unit
: Unit tests run in JSDOM with Jest, or in PhantomJS with Karma + Mocha + karma-webpack.- Supports ES2015+ in test files.
- Easy mocking.
-
npm run e2e
: End-to-end tests with Nightwatch.- Run tests in multiple browsers in parallel.
- Works with one command out of the box:
- Selenium and chromedriver dependencies automatically handled.
- Automatically spawns the Selenium server.
Fork It And Make Your Own
You can fork this repo to create your own boilerplate, and use it with vue-cli
:
vue init username/repo my-project
Top Related Projects
🛠️ webpack-based tooling for Vue.js Development
Set up a modern web app by running one command.
CLI tool for Angular
Template for building basic applications with Svelte
😺 Your next Preact PWA starts in 30 seconds.
Create and build modern JavaScript projects with zero initial configuration.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot