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

Fix build to use a defined global object ("this" instead of "self") #505

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*
!dist/klaro.js
!dist/**/*
2 changes: 1 addition & 1 deletion dist/cm-no-css.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/cm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ide-no-css.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ide.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/klaro-no-css.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/klaro-no-translations-no-css.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/klaro-no-translations.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/klaro.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/translations-no-css.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/translations.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
"src/**/*.ts",
"src/**/*.jsx",
"src/**/*.tsx",
"src/**/*.yml"
"src/**/*.yml",
"dist/**/*"
],
"homepage": "https://klaro.kiprotect.com/",
"keywords": [
Expand All @@ -83,4 +84,4 @@
"make-watch": "cross-env APP_ENV=dev webpack --mode development --watch --config webpack.config.js"
},
"version": "0.7.22"
}
}
20 changes: 10 additions & 10 deletions webpack.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const STYLE_FILES = /\.(sa|sc|c)ss$/;

const SEPARATE_CSS = process.env.SEPARATE_CSS !== undefined;

const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const BundleAnalyzerPlugin =
require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const ANALYZE_BUNDLE = process.env.ANALYZE_BUNDLE !== undefined;

let config = {
Expand Down Expand Up @@ -38,22 +39,23 @@ let config = {
exclude: /node_modules/,
include: [SRC_DIR],
loader: 'babel-loader',
}
},
],
},
entry: {
'klaro': path.join(SRC_DIR, 'klaro.js'),
klaro: path.join(SRC_DIR, 'klaro.js'),
'klaro-no-translations': path.join(SRC_DIR, 'klaro.js'),
cm: path.join(SRC_DIR, 'consent-manager.js'),
translations: path.join(SRC_DIR, 'translations.js'),
ide: path.join(SRC_DIR, 'ide.js')
ide: path.join(SRC_DIR, 'ide.js'),
},
output: {
path: BUILD_DIR,
filename: SEPARATE_CSS ? '[name]-no-css.js' : '[name].js',
library: '[name]',
libraryTarget: 'umd',
publicPath: '',
globalObject: 'this',
},
plugins: [],
};
Expand Down Expand Up @@ -91,7 +93,7 @@ if (SEPARATE_CSS) {
{
loader: 'sass-loader',
options: {
implementation: require.resolve("sass"),
implementation: require.resolve('sass'),
sassOptions: {
sourceMap: APP_ENV === 'development',
outputStyle: NO_MINIFY_CSS ? 'expanded' : 'compressed',
Expand All @@ -102,10 +104,8 @@ if (SEPARATE_CSS) {
});
config.plugins.push(
new MiniCssExtractPlugin({
filename: NO_MINIFY_CSS
? '[name].css'
: '[name].min.css',
}),
filename: NO_MINIFY_CSS ? '[name].css' : '[name].min.css',
})
);
} else {
config.module.rules.push({
Expand All @@ -128,7 +128,7 @@ if (SEPARATE_CSS) {
{
loader: 'sass-loader',
options: {
implementation: require.resolve("sass"),
implementation: require.resolve('sass'),
},
},
],
Expand Down