Skip to content

Commit

Permalink
Fix code for webpack 5 and lavarel-mix 6
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Nov 2, 2024
1 parent bd42eff commit 2227935
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 44 deletions.
5 changes: 2 additions & 3 deletions hugo/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"description": "Сайт подкаста Радио-Т",
"scripts": {
"build": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"build:stats": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --config=node_modules/laravel-mix/setup/webpack.config.js --profile --json > stats.json",
"build": "mix --production",
"hugo": "cross-env-shell hugo serve --minify --port ${HUGO_PORT:-1313}",
"hugo:no-live": "cross-env-shell hugo serve --minify --disableLiveReload --port ${HUGO_PORT:-1313}",
"dev": "cross-env NODE_ENV=development run-p dev:watch hugo",
"dev:watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"dev:watch": "mix watch",
"dev:turbo": "cross-env NODE_ENV=development cross-env MIX_TURBO=1 run-p dev:watch hugo:no-live",
"serve": "run-s build hugo",
"size": "npm run build && size-limit",
Expand Down
46 changes: 5 additions & 41 deletions hugo/webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ mix
'react': 'preact/compat',
'react-dom': 'preact/compat',
},
fallback: {
"buffer": require.resolve("buffer/")
}
},
})
.ts('src/js/app.js', '.')
Expand Down Expand Up @@ -83,6 +86,7 @@ if (process.env.ANALYZE) {
mix.webpackConfig({ plugins: [new BundleAnalyzerPlugin()] });
}

// Production and Development Paths
if (mix.inProduction()) {
Mix.manifest.name = '../../data/manifest.json'; // eslint-disable-line no-undef
mix.setPublicPath('static/build');
Expand Down Expand Up @@ -120,8 +124,6 @@ if (mix.inProduction()) {
target: `localhost:${process.env.HUGO_PORT || 1313}`,
ws: true, // support websockets for hugo live-reload
},
// watch: true,
// watch specific files
files: ['dev/*.css', 'dev/app.js'],
ghostMode: false, // disable Clicks, Scrolls & Form inputs on any device will be mirrored to all others
open: false, // don't open in browser
Expand All @@ -136,42 +138,4 @@ if (mix.inProduction()) {
},
},
});
}

// mix.version();

// Full API
// mix.js(src, output);
// mix.react(src, output); <-- Identical to mix.js(), but registers React Babel compilation.
// mix.preact(src, output); <-- Identical to mix.js(), but registers Preact compilation.
// mix.coffee(src, output); <-- Identical to mix.js(), but registers CoffeeScript compilation.
// mix.ts(src, output); <-- TypeScript support. Requires tsconfig.json to exist in the same folder as webpack.mix.js
// mix.extract(vendorLibs);
// mix.sass(src, output);
// mix.less(src, output);
// mix.stylus(src, output);
// mix.postCss(src, output, [require('postcss-some-plugin')()]);
// mix.browserSync('my-site.test');
// mix.combine(files, destination);
// mix.babel(files, destination); <-- Identical to mix.combine(), but also includes Babel compilation.
// mix.copy(from, to);
// mix.copyDirectory(fromDir, toDir);
// mix.minify(file);
// mix.sourceMaps(); // Enable sourcemaps
// mix.version(); // Enable versioning.
// mix.disableNotifications();
// mix.setPublicPath('path/to/public');
// mix.setResourceRoot('prefix/for/resource/locators');
// mix.autoload({}); <-- Will be passed to Webpack's ProvidePlugin.
// mix.webpackConfig({}); <-- Override webpack.config.js, without editing the file directly.
// mix.babelConfig({}); <-- Merge extra Babel configuration (plugins, etc.) with Mix's default.
// mix.then(function () {}) <-- Will be triggered each time Webpack finishes building.
// mix.extend(name, handler) <-- Extend Mix's API with your own components.
// mix.options({
// extractVueStyles: false, // Extract .vue component styling to file, rather than inline.
// globalVueStyles: file, // Variables file to be imported in every component.
// processCssUrls: true, // Process/optimize relative stylesheet url()'s. Set to false, if you don't want them touched.
// purifyCss: false, // Remove unused CSS selectors.
// terser: {}, // Terser-specific options. https://github.com/webpack-contrib/terser-webpack-plugin#options
// postCss: [] // Post-CSS options: https://github.com/postcss/postcss/blob/master/docs/plugins.md
// });
}

0 comments on commit 2227935

Please sign in to comment.