From 46935d345039d824ea5fd375d06824ab1e2380f5 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 24 Apr 2018 12:35:51 -0400 Subject: [PATCH] readme --- README.md | 304 +++++------------------------------------------------- 1 file changed, 28 insertions(+), 276 deletions(-) diff --git a/README.md b/README.md index 1716c1310..98ffa1b99 100644 --- a/README.md +++ b/README.md @@ -1,290 +1,42 @@ -# vue-loader@next [![Build Status](https://circleci.com/gh/vuejs/vue-loader/tree/next.svg?style=shield)](https://circleci.com/gh/vuejs/vue-loader/tree/next) [![Windows Build status](https://ci.appveyor.com/api/projects/status/8cdonrkbg6m4k1tm/branch/next?svg=true)](https://ci.appveyor.com/project/yyx990803/vue-loader/branch/next) +# vue-loader [![Build Status](https://circleci.com/gh/vuejs/vue-loader/tree/master.svg?style=shield)](https://circleci.com/gh/vuejs/vue-loader/tree/master) [![Windows Build status](https://ci.appveyor.com/api/projects/status/8cdonrkbg6m4k1tm/branch/master?svg=true)](https://ci.appveyor.com/project/yyx990803/vue-loader/branch/master) -This is the WIP branch of the next version of `vue-loader`. It uses a fairly different new architecture that is able to apply whatever rules defined in the main webpack config to the language blocks inside a `*.vue` file. +> webpack loader for Vue Single-File Components -## Example Usage +- [Documentation](https://vue-loader.vuejs.org) +- [Migrating from v14](https://vue-loader.vuejs.org/migrating.html) -``` js -// webpack.config.js -const path = require('path') -const { VueLoaderPlugin } = require('vue-loader') +## What is Vue Loader? -module.exports = { - mode: 'development', - module: { - rules: [ - { - test: /\.vue$/, - loader: 'vue-loader' - }, - // this will apply to both plain .js files - // AND -## CSS Extraction - -Works the same way as you'd configure it for normal CSS. Example usage with [mini-css-extract-plugin](https://github.com/webpack-contrib/mini-css-extract-plugin): - -``` js -{ - module: { - rules: [ - { - test: /\.vue$/, - use: 'vue-loader' - }, - { - test: /\.css$/, - // or ExtractTextWebpackPlugin.extract(...) - use: [ - MiniCssExtractPlugin.loader, - 'css-loader' - ] - } - ] - }, - plugins: [ - new MiniCssExtractPlugin({ - filename: 'output.css' - }) - ] + ``` -## SSR externals - -In SSR, we typically use `webpack-node-externals` to exclude npm dependencies from the server build. If you need to import CSS from an npm dependency, the previous solution was using a whitelist like this: - -``` js -// webpack config -externals: nodeExternals({ - whitelist: /\.css$/ -}) -``` - -With v15, imports for `