Uncaught SyntaxError: Unexpected token '<' (VueJS production build)

Использую VueJS, Webpack. Apache на сервере. Пытаюсь выкатить приложение на боевой сервер, но получаю ошибку:

Resource interpreted as Stylesheet but transferred with MIME type text/html: "https://.../". Uncaught SyntaxError: Unexpected token '<'

Есть работающий проект с аналогичной настройкой Webpack, аналогичным index.html и тп. Ни в index.html ни в index.js нет лишних '<'. Не знаю как исправить данную ошибку. На локальном сервере приложение работает без проблем.

src/index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Test</title>

    <% for (var css in htmlWebpackPlugin.files.css) { %>
    <link rel="stylesheet" href="<%= htmlWebpackPlugin.files.css[css] %>">
    <% } %>
</head>

<body>
<div id="Store"></div>

<% for (var js in htmlWebpackPlugin.files.js) { %>
<script src="<%= htmlWebpackPlugin.files.js[js] %>"></script>
<% } %>
</body>
</html>

build/index.html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Test</title>


    <link rel="stylesheet" href="assets/styles/index.b05ac24868294f8fc1e0.css?55ef280ff12d42361fc1">

</head>

<body>
<div id="Store"></div>


<script src="assets/scripts/vendors.4873be122f9b450a5930.js?55ef280ff12d42361fc1"></script>

<script src="assets/scripts/index.b05ac24868294f8fc1e0.js?55ef280ff12d42361fc1"></script>

</body>
</html>

webpack.base.config.js

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const {VueLoaderPlugin} = require('vue-loader');

const PATHS = {
    build: path.join(__dirname, '../build'),
    src: path.join(__dirname, '../src'),
    assets: 'assets/'
};

module.exports = {
    externals: {
        paths: PATHS
    },
    entry: {'index':
            [ "babel-polyfill", PATHS.src]
    },
    output: {
        path: PATHS.build,
        filename: `${PATHS.assets}scripts/[name].[chunkhash].js`,
    },
    optimization: {
        splitChunks: {
            cacheGroups: {
                vendor: {
                    name: 'vendors',
                    test: /node_modules/,
                    chunks: 'all',
                    enforce: true
                }
            }
        }
    },
    module: {
        rules: [
            {
                test: /\.scss$/,
                use: [
                    'style-loader',
                    MiniCssExtractPlugin.loader,
                    {
                        loader: 'css-loader',
                        options: { sourceMap: true }
                    }, {
                        loader: 'sass-loader',
                        options: { sourceMap: true }
                    }
                ]
            },
            {
                test: /\.sass$/,
                use: [
                    'style-loader',
                    MiniCssExtractPlugin.loader,
                    {
                        loader: 'css-loader',
                        options: { sourceMap: true }
                    }, {
                        loader: 'sass-loader?indentedSyntax',
                        options: { sourceMap: true }
                    }
                ]
            },
            {
                test: /\.css$/,
                use: [
                    'style-loader',
                    MiniCssExtractPlugin.loader,
                    {
                        loader: 'css-loader',
                        options: { sourceMap: true }
                    }
                ]
            },
            {
                test: /\.vue$/,
                loader: 'vue-loader',
                options: {
                    loaders: {
                        'scss': 'vue-style-loader!css-loader!sass-loader'
                    },
                    cssModules: {
                        localIdentName: '[path][name]---[local]---[hash:base64:5]',
                        camelCase: true
                    }
                }
            },
            {
                test: /\.js$/,
                loader: 'babel-loader',
                exclude: /node_modules/
            },
            {
                test: /\.(png|jpg|gif|svg)$/,
                loader: 'file-loader',
                options: {
                    limit: false,
                    name: '[name].[hash].[ext]',
                    outputPath: 'assets/images',
                    useRelativePath: true,
                    esModule: false
                }
            },
            {
                test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
                loader: 'file-loader',
                options: {
                    name: '[name].[ext]'
                }
            }
        ]
    },
    resolve: {
        extensions: ['*', '.js', '.vue', '.json']
    },
    plugins: [
        new VueLoaderPlugin(),
        new HtmlWebpackPlugin({
            inject: false,
            hash: true,
            template: `${PATHS.src}/index.html`,
            filename: 'index.html'
        }),
        new MiniCssExtractPlugin ({
            filename: `${PATHS.assets}styles/[name].[chunkhash].css`
        })
    ]
};

webpack.build.config.js

const merge = require('webpack-merge');
const baseWebpackConfig = require('./webpack.base.config');
const {CleanWebpackPlugin} = require('clean-webpack-plugin');
const buildWebpackConfig = merge(baseWebpackConfig, {
    mode: 'production',
    plugins: [
        new CleanWebpackPlugin()
    ],
    output: {
        publicPath: ''
    }
});

module.exports = new Promise((resolve, reject) => {
    resolve(buildWebpackConfig)
});

Ответы (0 шт):