Skip to content

Commit

Permalink
Improve webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-gardener committed Oct 11, 2023
1 parent 4b2ec1d commit b4b2ff1
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 22 deletions.
1 change: 0 additions & 1 deletion public/js/dist/main.js.map

This file was deleted.

4 changes: 2 additions & 2 deletions public/js/dist/main.js → public/js/dist/mvm.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions public/js/dist/mvm.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions public/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"sass": "^1.63.6",
"sass-loader": "^13.3.2",
"webpack": "^5.76.0",
"webpack-cli": "^5.1.4",
"webpack-remove-empty-scripts": "^1.0.3"
"webpack-cli": "^5.1.4"
}
}
14 changes: 10 additions & 4 deletions public/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const path = require('path');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const RemoveEmptyScriptsPlugin = require('webpack-remove-empty-scripts');

module.exports = {
entry: {
main: './js/mvm.js',
mvm: './sass/mvm.scss',
mvm: [
'./js/mvm.js',
'./sass/mvm.scss',
],
},
mode: 'production',
stats: {
Expand Down Expand Up @@ -51,11 +52,16 @@ module.exports = {
},
plugins: [
// css extraction into dedicated file
new RemoveEmptyScriptsPlugin({ verbose: true }),
new MiniCssExtractPlugin({
filename: './css/[name].css',
}),
],
watchOptions: {
ignored: [
'**/fonts',
'**/images',
],
},
resolve: {
extensions: ['.js', '.scss'],
modules: ['node_modules'],
Expand Down
12 changes: 0 additions & 12 deletions public/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@ ajv@^8.0.0, ajv@^8.9.0:
require-from-string "^2.0.2"
uri-js "^4.2.2"

[email protected]:
version "1.5.2"
resolved "https://registry.yarnpkg.com/ansis/-/ansis-1.5.2.tgz#c9bada6ff5dd88b0b979ab8df0b51096b9dda4bb"
integrity sha512-T3vUABrcgSj/HXv27P+A/JxGk5b/ydx0JjN3lgjBTC2iZUFxQGjh43zCzLSbU4C1QTgmx9oaPeWNJFM+auI8qw==

anymatch@~3.1.2:
version "3.1.3"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e"
Expand Down Expand Up @@ -1161,13 +1156,6 @@ webpack-merge@^5.7.3:
clone-deep "^4.0.1"
wildcard "^2.0.0"

webpack-remove-empty-scripts@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/webpack-remove-empty-scripts/-/webpack-remove-empty-scripts-1.0.3.tgz#9ca80d4cf5f1ad2776b970a415649869b0004aef"
integrity sha512-1+Gg43r+4REb+3AUWbgjM3LIlxxE8YIqMnGpOmmhnaYK2rv4q58WbHYhZ9IRhTyt/+1qWoKQoPz/ebze5RnRYA==
dependencies:
ansis "1.5.2"

webpack-sources@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde"
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
</div>
</footer>

<script src="{{ asset_prefix|default('') ~ asset('js/dist/main.js') }}"></script>
<script src="{{ asset_prefix|default('') ~ asset('js/dist/mvm.js') }}"></script>
{% block javascripts %}
{% endblock %}

Expand Down

0 comments on commit b4b2ff1

Please sign in to comment.