This is my first attempt with the webpack-simple template. I have very little experience with webpack in general and am hoping someone can help point me in the right direction. I am trying to deploy a Vue app that uses webpack-simple to Netlify.
It's my understanding that I should just be able to run npm run build or yarn build on Netlify, and voila... But, I'm getting a 404 after the deploy. Below are the files that should impact the deployment on Netlify:
Here's my webpack config:
var path = require('path')
var webpack = require('webpack')
require("babel-polyfill");
module.exports = {
entry: ["babel-polyfill", './src/main.js'],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: '/dist/',
filename: 'build.js'
},
module: {
rules: [
{
test: /\.css$/,
use: [
'vue-style-loader',
'css-loader'
],
}, {
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {
}
}
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(png|jpg|gif)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
},
{
test: /\.(woff|woff2)(\?.*$|$)/,
loader: 'url-loader?importLoaders=1&limit=100000'
},
{
test: /\.svg$/,
loader: 'vue-svg-loader',
},
]
},
resolve: {
alias: {
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['*', '.js', '.vue', '.json']
},
devServer: {
historyApiFallback: true,
noInfo: true,
overlay: true
},
performance: {
hints: false
},
devtool: '#eval-source-map'
}
if (process.env.NODE_ENV === 'production') {
module.exports.devtool = '#source-map'
// http://vue-loader.vuejs.org/en/workflow/production.html
module.exports.plugins = (module.exports.plugins || []).concat([
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
sourceMap: true,
compress: {
warnings: false
}
}),
new webpack.LoaderOptionsPlugin({
minimize: true
})
])
}
And my package.json. I have everything in dependencies as opposed to devDependencies, but Netlify sometimes chokes on dev dependencies for me.
{
"name": "quotes",
"description": "blah blah blah",
"version": "1.0.0",
"author": "Me",
"license": "MIT",
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules"
},
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-plugin-transform-regenerator": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.0",
"babel-preset-stage-3": "^6.24.1",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"cross-env": "^5.0.5",
"css-loader": "^0.28.7",
"file-loader": "^1.1.4",
"html-loader": "^0.5.5",
"prettier": "^1.12.1",
"url-loader": "^1.1.1",
"vue": "^2.5.11",
"vue-loader": "^13.0.5",
"vue-router": "^3.0.1",
"vue-svg-loader": "^0.10.0",
"vue-template-compiler": "^2.4.4",
"vuelidate": "^0.7.4",
"webpack": "^3.6.0",
"webpack-dev-server": "^2.9.1"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
My vue.config
module.exports = {
baseUrl: '/'
}
And finally, my babel.rc
{
"presets": [
["env", { "modules": false }],
"stage-3"
],
"plugins": [
"syntax-dynamic-import",
"transform-regenerator"
]
}
There are no errors in the deployment log. Netlify suggests that the site is deployed. But, I keep getting a "Page Not found" error. I suspect I'm missing something simple here.
Also, when I run the build in my local dev environment, I see only two files in my dist folder. They are a build.js and a build.js.map file. Should I also see an html file in there somewhere? Any help is appreciated. Thank you.