Commit 6a9cab61 authored by Evan You's avatar Evan You

chore: add example and .npmignore

parent 8dde0480
......@@ -2,3 +2,4 @@
exploration
node_modules
*.log
example/dist
example
test
*.yml
*.log
yarn.lock
<div id="app"></div>
<script src="/dist/bundle.js"></script>
import Vue from 'vue'
import Foo from './source.vue'
new Vue({
el: '#app',
render: h => h(Foo)
})
<template>
<div>
<h1 :class="$style.red">{{ msg }}</h1>
</div>
</template>
<script>
export default {
data () {
return {
msg: 'fesfff'
}
}
}
</script>
<style module>
.red {
color: red;
}
</style>
<foo>
export default comp => {
console.log(comp.options.data())
}
</foo>
const path = require('path')
const VueLoaderPlugin = require('../lib/plugin')
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, './main.js'),
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/dist/'
},
devServer: {
stats: "minimal",
contentBase: __dirname
},
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
resourceQuery: /blockType=foo/,
loader: 'babel-loader'
},
{
test: /\.css$/,
oneOf: [
{
resourceQuery: /module/,
use: [
'vue-style-loader',
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[local]_[hash:base64:8]'
}
}
]
},
{
use: [
'vue-style-loader',
'css-loader'
]
}
]
},
{
test: /\.scss$/,
use: [
'vue-style-loader',
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[local]_[hash:base64:8]'
}
},
{
loader: 'sass-loader',
options: {
data: '$color: red;'
}
}
]
}
]
},
resolveLoader: {
alias: {
'vue-loader': require.resolve('../lib')
}
},
plugins: [
new VueLoaderPlugin()
]
}
......@@ -6,8 +6,8 @@
"scripts": {
"test": "jest --env node",
"lint": "eslint lib test --fix",
"build": "webpack --config exploration/webpack.config.js",
"dev": "webpack-dev-server --config exploration/webpack.config.js --inline --hot"
"build": "webpack --config example/webpack.config.js --hide-modules",
"dev": "webpack-dev-server --config example/webpack.config.js --inline --hot"
},
"author": "Evan You",
"license": "MIT",
......@@ -43,6 +43,7 @@
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"conventional-changelog": "^1.1.19",
"css-loader": "^0.28.11",
"eslint": "^4.19.0",
"eslint-plugin-vue-libs": "^2.1.0",
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment