webpack-dev-server
「wds」: Project is running at http://localhost:8000/
「wds」: webpack output is served from /
「wds」: Content not from webpack is served from ./dist
const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
module.exports = {
mode: 'development',
devtool: 'source-map',
entry: path.join(__dirname, 'src', 'main', 'resources', 'static', 'js', 'main.js'),
devServer: {
contentBase: './dist',
compress: true,
port: 8000,
allowedHosts: [
'localhost:8080'
]
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
},
{
test: /\.vue$/,
loader: 'vue-loader'
}
]
},
plugins: [
new VueLoaderPlugin()
],
resolve: {
modules: [
path.join(__dirname, 'src', 'main', 'resources', 'static', 'js'),
path.join(__dirname, 'node_modules'),
],
}
}
{
"dependencies": {
"vue": "^2.6.10",
"vue-resource": "^1.5.1"
},
"devDependencies": {
"@babel/core": "^7.6.0",
"@babel/preset-env": "^7.6.0",
"babel": "^6.23.0",
"babel-loader": "^8.0.6",
"vue-loader": "^15.7.1",
"vue-template-compiler": "^2.6.10",
"webpack": "^4.40.2",
"webpack-cli": "^3.3.8",
"webpack-dev-server": "^3.8.0",
"wepack-cli": "^0.0.1-security"
},
"name": "ui",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"start": "webpack-dev-server"
}
}