Well, no meter what, I am getting another error:
Its quite similar to the previous one
Uncaught promise rejection:
TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at visit (D:\Work\TRIMS-app\node_modules\toposort\index.js:29:50)
at visit (D:\Work\TRIMS-app\node_modules\toposort\index.js:47:9)
at Function.toposort [as array] (D:\Work\TRIMS-app\node_modules\toposort\index.js:22:22)
at Object.module.exports.dependency (D:\Work\TRIMS-app\node_modules\html-webpack-plugin\lib\chunksorter.js:50:35)
at HtmlWebpackPlugin.sortChunks (D:\Work\TRIMS-app\node_modules\html-webpack-plugin\index.js:364:35)
at D:\Work\TRIMS-app\node_modules\html-webpack-plugin\index.js:113:21
at _next2 (eval at create (D:\Work\TRIMS-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:18:1)
at _err2 (eval at create (D:\Work\TRIMS-app\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:32:1)
at callback (D:\Work\TRIMS-app\node_modules\copy-webpack-plugin\dist\index.js:77:17)
at D:\Work\TRIMS-app\node_modules\copy-webpack-plugin\dist\index.js:118:24
Here is my webpack config:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackExcludeAssetsPlugin = require('html-webpack-exclude-assets-plugin');
const project = require('./aurelia_project/aurelia.json');
const {AureliaPlugin, ModuleDependenciesPlugin} = require('aurelia-webpack-plugin');
const {ProvidePlugin} = require('webpack');
const {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer');
const webpack = require('webpack');
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
const TerserPlugin = require('terser-webpack-plugin');
// config helpers:
const ensureArray = (config) => config && (Array.isArray(config) ? config : [config]) || [];
const when = (condition, config, negativeConfig) =>
condition ? ensureArray(config) : ensureArray(negativeConfig);
// primary config:
const title = 'Loading...';
const outDir = path.resolve(__dirname, project.platform.output);
const srcDir = path.resolve(__dirname, 'src');
const nodeModulesDir = path.resolve(__dirname, 'node_modules');
const baseUrl = '/';
module.exports = ({production, server, extractCss, coverage, analyze, versionInfo} = {}) => {
const cssRules = [
{loader: 'css-loader', options: {minimize: production}}
];
const tinyMceStyles = new ExtractTextPlugin({
filename: 'styles/tiny-mce.css',
allChunks: true
});
const regularStyles = new ExtractTextPlugin({
filename: production ? 'styles/[name].[hash].css' : 'styles/[id].css',
allChunks: true
});
return ({
resolve: {
extensions: ['.js'],
modules: [srcDir, 'node_modules'],
alias: {
'jquery': path.resolve(__dirname, 'node_modules/jquery')
}
},
entry: {
app: ['aurelia-bootstrapper'],
vendor: [
// 'bluebird',
'element-closest',
'es7-object-polyfill',
'ismobilejs',
'babel-polyfill'
]
},
mode: production ? 'production' : 'development',
output: {
path: outDir,
publicPath: baseUrl,
filename: production ? 'js/[name].[chunkhash].bundle.js' : 'js/[name].[hash].bundle.js',
sourceMapFilename: production ? 'js/[name].[chunkhash].bundle.map' : 'js/[name].[hash].bundle.map',
chunkFilename: production ? 'js/[name].[chunkhash].chunk.js' : 'js/[name].[hash].chunk.js'
},
performance: {hints: false},
devServer: {
contentBase: outDir,
// serve index.html for all 404 (required for push-state)
historyApiFallback: true
},
optimization: {
minimizer: [
new TerserPlugin({
terserOptions: {
output: {
comments: false
}
}
})
]
},
devtool: production ? 'nosources-source-map' : 'cheap-module-eval-source-map',
module: {
rules: [
{
test: /\.css$/i,
issuer: path.resolve(__dirname, 'src/tiny-mce.js'),
use: tinyMceStyles.extract({
fallback: 'style-loader',
use: 'css-loader'
})
},
{
test: /\.scss$/,
issuer: path.resolve(__dirname, 'src/tiny-mce.js'),
use: tinyMceStyles.extract({
fallback: 'style-loader',
use: ['css-loader', 'sass-loader']
})
},
// CSS required in JS/TS files should use the style-loader that auto-injects it into the website
// only when the issuer is a .js/.ts file, so the loaders are not applied inside html templates
{
test: /\.css$/i,
issuer: [{not: [{test: /\.html$/i}, path.resolve(__dirname, 'src/tiny-mce.js')]}],
use: extractCss ? regularStyles.extract({
fallback: 'style-loader',
use: cssRules
}) : ['style-loader', ...cssRules]
},
{
test: /\.css$/i,
issuer: [{test: /\.html$/i}],
// CSS required in templates cannot be extracted safely
// because Aurelia would try to require it again in runtime
use: cssRules
},
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
// use: regularStyles.extract({
// fallback: 'style-loader',
// use: ['css-loader', 'sass-loader']
// }),
// issuer: /\.[tj]s$/i
issuer: {
include: [{test: /\.[tj]s$/i}],
not: [path.resolve(__dirname, 'src/tiny-mce.js')]
}
},
{
test: /\.scss$/,
use: ['css-loader', 'sass-loader'],
issuer: /\.html?$/i
},
{
test: /\.html$/i,
loader: 'html-loader',
options: {
minimize: true,
attrs: [
'a:href',
'img:src'
]
}
},
{
test: /\.js$/i, loader: 'babel-loader', exclude: nodeModulesDir,
options: coverage ? {sourceMap: 'inline', plugins: ['istanbul']} : {}
},
// { test: /\.json$/i, loader: 'json-loader' },
// use Bluebird as the global Promise implementation:
{test: /[\/\\]node_modules[\/\\]bluebird[\/\\].+\.js$/, loader: 'expose-loader?Promise'},
// embed small images and fonts as Data Urls and larger ones as files:
{
test: /\.(png|gif|jpg|cur)$/i,
loader: 'url-loader',
options: {limit: 8192, outputPath: 'images'}
},
{
test: /\.woff2(\?v=[0-9]\.[0-9]\.[0-9])?$/i,
loader: 'url-loader',
options: {limit: 10000, mimetype: 'application/font-woff2', outputPath: 'fonts'}
},
{
test: /\.woff(\?v=[0-9]\.[0-9]\.[0-9])?$/i,
loader: 'url-loader',
options: {limit: 10000, mimetype: 'application/font-woff', outputPath: 'fonts'}
},
// load these fonts normally, as files:
{
test: /\.(ttf|eot|svg|otf)(\?v=[0-9]\.[0-9]\.[0-9])?$/i,
loader: 'file-loader',
options: {outputPath: 'fonts'}
},
{
test: /\.worker\.js$/,
use: [
{ loader: 'worker-loader' },
{ loader: 'babel-loader' }
]
}
]
},
plugins: [
new AureliaPlugin(),
new ProvidePlugin({
'Promise': 'bluebird'
}),
new ProvidePlugin({
'jQuery': 'jquery',
'$': 'jquery',
'moment': 'moment',
'isMobile': 'ismobilejs'
}),
new DuplicatePackageCheckerPlugin(),
new webpack.IgnorePlugin(/jqvmap\/node_modules\/jquery\/dist\/jquery/),
new webpack.IgnorePlugin(/^codemirror$/),
new webpack.DefinePlugin({
__VERSION__: JSON.stringify(versionInfo)
}),
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
new ModuleDependenciesPlugin({
'aurelia-testing': ['./compile-spy', './view-spy']
}),
new CopyWebpackPlugin([
{from: 'src/locales/', to: 'locales/'}
]),
new CopyWebpackPlugin([
{
from: '**/*.json', to: 'locales/modules/country-list',
context: 'node_modules/@umpirsky/country-list/data/'
},
{
from: '*.svg', to: 'country-flags',
context: 'node_modules/svg-country-flags/svg'
},
{
from: '**/*.*', to: 'styles/tinymce-skins/',
context: 'node_modules/tinymce/skins'
},
{
from: '*(css|img|js|sounds)/**/*.*', to: 'file_manager',
context: 'node_modules/elfinder'
},
{
from: 'main.default.js', to: 'file_manager',
context: 'node_modules/elfinder'
},
{
from: 'elfinder-mce.html', to: 'file_manager',
context: 'elfinder'
},
{
from: '**/*.*', to: 'file_manager/themes/Material',
context: 'node_modules/elfinder-material-theme/Material'
},
{
from: '.trash/.gitignore', to: 'uploads/.trash',
context: 'elfinder_storage',
toType: 'dir'
},
{
from: '.gitignore', to: 'uploads',
context: 'elfinder_storage',
toType: 'dir'
}
], {debug: false}),
new HtmlWebpackPlugin({
template: 'index.ejs',
minify: production ? {
removeComments: true,
collapseWhitespace: true
} : undefined,
metadata: {
// available in index.ejs //
title, server, baseUrl
},
excludeAssets: [/tiny-mce\.css/]
}),
new HtmlWebpackExcludeAssetsPlugin(),
tinyMceStyles,
new CopyWebpackPlugin([
{from: 'static/*', flatten: true},
{from: 'static/.htaccess', to: '.htaccess', toType: 'file'}]),
...when(extractCss, regularStyles),
...when(analyze, new BundleAnalyzerPlugin())
]
});
};