From 7dbb43e0ed0bbc2026af0ac12b304d87cf730285 Mon Sep 17 00:00:00 2001 From: bach Date: Tue, 28 Feb 2023 16:58:43 +0100 Subject: [PATCH] htaccess for routing #2054 --- build/webpack.config.base.js | 12 +++++++----- build/webpack.config.prod.js | 15 ++++++++++++++- static/.htaccess | 11 +++++++++++ 3 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 static/.htaccess diff --git a/build/webpack.config.base.js b/build/webpack.config.base.js index ad6a4db..4500563 100644 --- a/build/webpack.config.base.js +++ b/build/webpack.config.base.js @@ -74,10 +74,12 @@ module.exports = { }), new HtmlWebpackHarddiskPlugin(), new VueLoaderPlugin(), - new CopyWebpackPlugin([{ - from: utils.resolve('static/img'), - to: utils.resolve('dist/static/img'), - toType: 'dir' - }]) + new CopyWebpackPlugin([ + { + from: utils.resolve('static/img'), + to: utils.resolve('dist/static/img'), + toType: 'dir' + } + ]) ] } diff --git a/build/webpack.config.prod.js b/build/webpack.config.prod.js index b6b1fda..ab1795c 100644 --- a/build/webpack.config.prod.js +++ b/build/webpack.config.prod.js @@ -1,16 +1,24 @@ 'use strict' const webpack = require('webpack') +const CopyWebpackPlugin = require('copy-webpack-plugin') const merge = require('webpack-merge') const baseConfig = require('./webpack.config.base') const MiniCssExtractPlugin = require('mini-css-extract-plugin') +const utils = require('./utils') + const UglifyJSPlugin = require('uglifyjs-webpack-plugin') // ERROR in vendor.js from UglifyJs // RangeError: Maximum call stack size exceeded module.exports = merge(baseConfig, { mode: 'production', + // resolve: { + // alias: { + // 'static': utils.resolve('static') + // } + // }, output: { publicPath: '/' }, @@ -66,6 +74,11 @@ module.exports = merge(baseConfig, { }), new webpack.DefinePlugin({ "process.env": "'prod'" - }) + }), + new CopyWebpackPlugin([{ + from: utils.resolve('static/.htaccess'), + to: utils.resolve('dist/.htaccess'), + toType: 'file' + }]) ] }) diff --git a/static/.htaccess b/static/.htaccess new file mode 100644 index 0000000..0e6cde9 --- /dev/null +++ b/static/.htaccess @@ -0,0 +1,11 @@ + + Options -MultiViews + + + RewriteEngine On + RewriteBase / + RewriteRule ^index\.html$ - [L] + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.html [L] + \ No newline at end of file