Code cleanup

This commit is contained in:
David Négrier 2021-05-17 14:46:32 +02:00
parent 9c4c6f2d53
commit db40681be7

View file

@ -1,9 +1,5 @@
import type {Configuration} from "webpack"; import type {Configuration} from "webpack";
import type WebpackDevServer from "webpack-dev-server"; import type WebpackDevServer from "webpack-dev-server";
//import SveltePreprocess from 'svelte-preprocess';
//import Autoprefixer from 'autoprefixer';
//import autoPreprocess from 'svelte-preprocess';
import path from 'path'; import path from 'path';
import webpack from 'webpack'; import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin'; import HtmlWebpackPlugin from 'html-webpack-plugin';
@ -11,12 +7,6 @@ import MiniCssExtractPlugin from 'mini-css-extract-plugin';
import sveltePreprocess from 'svelte-preprocess'; import sveltePreprocess from 'svelte-preprocess';
import NodePolyfillPlugin from 'node-polyfill-webpack-plugin'; import NodePolyfillPlugin from 'node-polyfill-webpack-plugin';
//const path = require('path');
//const webpack = require('webpack');
//const HtmlWebpackPlugin = require('html-webpack-plugin');
//const MiniCssExtractPlugin = require('mini-css-extract-plugin');
//const sveltePreprocess = require('svelte-preprocess');
const mode = process.env.NODE_ENV ?? 'development'; const mode = process.env.NODE_ENV ?? 'development';
const isProduction = mode === 'production'; const isProduction = mode === 'production';
const isDevelopment = !isProduction; const isDevelopment = !isProduction;
@ -88,22 +78,10 @@ module.exports = {
noPreserveState: false, noPreserveState: false,
optimistic: true, optimistic: true,
}, },
//preprocess: autoPreprocess({}),
preprocess: sveltePreprocess({ preprocess: sveltePreprocess({
scss: true, scss: true,
sass: true, sass: true,
}) })
// FIXME: SveltePreprocess does not work here
/*preprocess: SveltePreprocess({
scss: true,
sass: true,
postcss: {
plugins: [
//Autoprefixer
]
}
})*/
} }
} }
}, },
@ -138,9 +116,6 @@ module.exports = {
path: path.resolve(__dirname, 'dist'), path: path.resolve(__dirname, 'dist'),
publicPath: '/' publicPath: '/'
}, },
/*externals:[
require('webpack-require-http')
],*/
plugins: [ plugins: [
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new MiniCssExtractPlugin({filename: '[name].[contenthash].css'}), new MiniCssExtractPlugin({filename: '[name].[contenthash].css'}),