Skip to content

Commit 43a3a7e

Browse files
committed
Issue #459-#460: Fixed asset building issues
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
1 parent 72a20f2 commit 43a3a7e

6 files changed

Lines changed: 26 additions & 44 deletions

File tree

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
"chart.js": "^4.5.1",
3030
"jquery": "^4.0.0",
3131
"jquery-migrate": "^4.0.2",
32+
"jquery-sparkline": "^2.4.0",
3233
"lodash": "^4.18.1",
33-
"moment": "^2.30.1",
34-
"jquery-sparkline": "^2.4.0"
34+
"moment": "^2.30.1"
3535
},
3636
"devDependencies": {
3737
"@babel/core": "^7.24.7",
@@ -50,6 +50,7 @@
5050
"mini-css-extract-plugin": "^2.9.0",
5151
"sass": "^1.77.1",
5252
"sass-loader": "^14.2.1",
53+
"terser-webpack-plugin": "^5.6.1",
5354
"webpack": "^5.92.1",
5455
"webpack-cli": "^5.1.4"
5556
},

public/js/admin.js

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/app.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/table_settings.js

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/js/user.js

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.config.js

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Webpack is used to compile and minify/uglify JS and Sass.
3-
* Since this will nuke some of the directories inside the public directory,
3+
* Since this will nuke some directories inside the public directory,
44
* you should no longer manually add images etc. to the public folder.
55
* We have set up a configuration that will automatically copy any image
66
* from the images folder here to public/images/{moduleName}.
@@ -50,8 +50,8 @@ const { CleanWebpackPlugin } = require('clean-webpack-plugin');
5050
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
5151
const TerserPlugin = require('terser-webpack-plugin');
5252

53-
// Prepare plugin to extract styles into a css file
54-
// instead of a javascript file
53+
// Prepare plugin to extract styles into a CSS file
54+
// instead of a JavaScript file
5555

5656
// dynamically build webpack entries based on registered app modules
5757
let entries = {
@@ -96,26 +96,37 @@ appModules.forEach(function (appModule) {
9696
}
9797
});
9898

99+
Object.keys(entries).forEach(function (name) {
100+
if (name === 'app') {
101+
return;
102+
}
103+
104+
entries[name] = {
105+
import: entries[name],
106+
dependOn: 'app',
107+
};
108+
});
109+
99110
/*
100111
* Lastly, export the final module
101112
* and the assets
102113
*/
103114
module.exports = {
104115
// This is the basepath for Webpack to look for source files
105-
// if you need to include modules outside of the App module,
116+
// if you need to include modules outside the App module,
106117
// move the "/App/assets" portion of the context onto the two
107118
// strings below, so it becomes "./App/assets/js/app.js" etc.
108119
context: path.resolve(__dirname, './src'),
109120

110121
// These are our entry files, this is the files Webpack will use
111-
// when looking for Sass and Javascript to compile.
122+
// when looking for Sass and JavaScript to compile.
112123
// The format is "DESTINATION": "SOURCE", and each path is
113124
// relative to the output path and the context respectively.
114125
entry: entries,
115126

116127
// The Output is where Webpack will export our files to
117128
// the filename will be resolved to the key in the entry object above.
118-
// The publicPath is what it'll rewrite css relative urls to use.
129+
// The publicPath is what it'll rewrite CSS relative urls to use.
119130
// The path is where it'll save files too
120131
output: {
121132
filename: './js/[name].js',
@@ -236,7 +247,7 @@ function generateBaseRules()
236247
test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
237248
exclude: [/images?|img/],
238249
use: [
239-
// As SVG may count as both font or image
250+
// As SVG may count as both font or image,
240251
// we will not treat any file in a folder
241252
// with the name image(s) or img as a font
242253
'file-loader?name=fonts/[name].[ext]'

0 commit comments

Comments
 (0)