Skip to content

Commit

Permalink
Add missing CSS in dist folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Sep 20, 2024
1 parent 7f56a79 commit a4a4e1a
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 11 deletions.
9 changes: 6 additions & 3 deletions buildtools/webpack.commons.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

const path = require('path');
const webpack = require('webpack');
const {PromiseTask} = require('event-hooks-webpack-plugin/lib/tasks');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

const devMode = process.env.NODE_ENV !== 'production';

Expand Down Expand Up @@ -85,13 +85,13 @@ module.exports = function (config) {

rules.push({
test: /\.css$/,
use: [{loader: 'style-loader'}, {loader: 'css-loader'}],
use: [{loader: MiniCssExtractPlugin.loader}, {loader: 'css-loader'}],
});

rules.push({
test: /\.s[ac]ss$/i,
use: [
{loader: 'style-loader'},
{loader: MiniCssExtractPlugin.loader},
{loader: 'css-loader'},
{loader: 'sass-loader', options: {warnRuleAsWarning: false}},
],
Expand Down Expand Up @@ -141,6 +141,9 @@ module.exports = function (config) {
resourceRegExp: /^\.\/locale$/,
contextRegExp: /node_modules\/moment\/src\/lib\/locale$/,
}),
new MiniCssExtractPlugin({
filename: '[name]-[contenthash:6].css',
}),
];
if (config.nodll != true) {
plugins.push(dllPlugin);
Expand Down
26 changes: 21 additions & 5 deletions buildtools/webpack.dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,26 @@
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const plugins = [];
const entry = {};

for (const name of ['desktop', 'mobile', 'iframe_api']) {
const folder = `contribs/gmf/apps/${name}`;
entry[name] = `./${folder}/Controller.js`;
plugins.push(
new HtmlWebpackPlugin({
template: `${folder}/index.html.ejs`,
inject: false,
filename: `${name}.html`,
chunks: [name],
}),
);
}

module.exports = {
entry: {
desktop: './contribs/gmf/apps/desktop_alt/Controller.js',
mobile: './contribs/gmf/apps/mobile_alt/Controller.js',
iframe_api: './contribs/gmf/apps/iframe_api/Controller.js',
},
entry: entry,
plugins: plugins,
};
2 changes: 1 addition & 1 deletion buildtools/webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = function () {
mode: 'production',
devtool: 'source-map',
output: {
filename: '[name].[chunkhash:6].js',
filename: '[name]-[chunkhash:6].js',
assetModuleFilename: '[name]-[contenthash:6][ext]',
},
plugins: [new webpack.optimize.ModuleConcatenationPlugin()],
Expand Down
110 changes: 109 additions & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
"karma-webpack": "5.0.1",
"loader-utils": "3.3.1",
"magic-comments-loader": "2.1.3",
"mini-css-extract-plugin": "2.9.1",
"minify-html-literals-loader": "1.1.1",
"neat-csv": "6.0.1",
"parse-absolute-css-unit": "1.0.2",
Expand All @@ -198,7 +199,6 @@
"start-server-and-test": "2.0.5",
"storybook": "8.2.9",
"strip-bom": "5.0.0",
"style-loader": "4.0.0",
"svgo": "3.3.2",
"svgo-loader": "4.0.0",
"terser": "5.31.6",
Expand Down

0 comments on commit a4a4e1a

Please sign in to comment.