Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Work toward Webpack 5 with Svue #89

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
svelte-check-plugin and resolve warnings, devServer hot load
  • Loading branch information
thadk committed Feb 22, 2022
commit 969e2bd979d081c82b47bf9ea680adc63009c6d7
23 changes: 20 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"svelte-loader": "3.1.2",
"svelte-preprocess": "4.10.3",
"svelte-check": "^2.4.5",
"svelte-check-plugin": "1.0.2",
"svelte-preprocess-sass": "2.0.1",
"svg-inline-loader": "^0.8.0",
"svue": "^1.5.3",
Expand All @@ -37,6 +38,7 @@
"webpack-cli": "4.9.2",
"webpack-dev-server": "4.7.4",
"@tsconfig/svelte": "^3.0.0",
"typescript": "4.5.5",
"process":"0.11.10"
},
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/common/Image.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@

// Fix blurry image bug
// https://stackoverflow.com/a/36787557
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
transform: translateZ(0);
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/ProgressiveImage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
top: 0;
left: 0;

user-drag: none;
-webkit-user-drag: none; /* only on webkit */
user-select: none;

transition: opacity 0.2s linear;
Expand Down
1 change: 1 addition & 0 deletions webpack.app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
Dylan had this on v3
https://github.com/webpack/webpack-dev-server/blob/master/migration-v4.md
*/
hot: true,
allowedHosts: 'all',
host: "0.0.0.0",
port: 80,
Expand Down
19 changes: 18 additions & 1 deletion webpack.base.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* TODO: switch to imports instead of require https://github.com/baileyherbert/svelte-webpack-starter/blob/main/webpack.config.ts */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

const path = require("path");
const autoPreprocess = require("svelte-preprocess");
const { preprocessOptions } = require("./preprocess.config.js");
// import SvelteCheckPlugin from 'svelte-check-plugin';
const SvelteCheckPlugin = require('svelte-check-plugin');

const DotenvWebpack = require('dotenv-webpack');
const dotenv = require('dotenv');
Expand All @@ -22,9 +23,23 @@ const BundleAnalyzerPlugin = require("webpack-bundle-analyzer")
// Speed measurer
const smp = new SpeedMeasurePlugin();


const environment =
process.env.NODE_ENV == null ? "development" : process.env.NODE_ENV;

/**
* Change this to `true` to run svelte-check during hot reloads. This will impact build speeds but will show more
* thorough errors and warnings.
*/
const svelteCheckInDevelopment = false;

/**
* Change this to `false` to disable svelte-check during production builds. Build speeds will be faster, but error
* and warning checks will be less thorough.
*/
const svelteCheckInProduction = true;


const useAnalyzer = environment.endsWith("analyze");

const prod =
Expand Down Expand Up @@ -198,6 +213,8 @@ module.exports = wrap({
// }
// },
}),
...(svelteCheckInDevelopment || prod && svelteCheckInProduction ? [new SvelteCheckPlugin()] : [])
,
...(useAnalyzer
? [
new BundleAnalyzerPlugin({
Expand Down