Skip to content
Merged
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
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('kolibri-build/babel.config');
module.exports = require('kolibri-jest-config/jest.conf/babel.config');
25 changes: 25 additions & 0 deletions kolibri/core/buildConfig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// This is only used during build time, so OK to reference files outside of Kolibri src.
const path = require('node:path');
const { kolibriName } = require('kolibri-build');

module.exports = [
Expand All @@ -11,6 +12,30 @@ module.exports = [
libraryExport: 'default',
libraryTarget: 'window',
},
module: {
rules: [
{
// Use babel-loader only for the entry file that imports core-js,
// so that @babel/preset-env can expand `import 'core-js'` into
// granular polyfill imports based on the browserslist targets.
test: /\.(js|mjs)$/,
include: [path.resolve(__dirname, 'frontend/index.js')],
loader: 'babel-loader',
options: {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'entry',
corejs: '3.31',
},
],
],
sourceType: 'unambiguous',
},
},
],
},
},
},
];
3 changes: 3 additions & 0 deletions kolibri/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"private": true,
"version": "0.0.1",
"dependencies": {
"@babel/core": "^7.29.0",
"@babel/preset-env": "^7.29.2",
"@vueuse/core": "catalog:",
"babel-loader": "^10.1.1",
"browserslist-config-kolibri": "workspace:*",
"core-js": "catalog:",
"kolibri": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
"vue-demi"
],
"onlyBuiltDependencies": [
"@swc/core",
"core-js",
"deasync",
"es5-ext",
Expand Down
13 changes: 0 additions & 13 deletions packages/kolibri-build/babel.config.js

This file was deleted.

10 changes: 3 additions & 7 deletions packages/kolibri-build/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kolibri-build",
"version": "1.0.0",
"version": "1.1.0",
"description": "Build tools and webpack configuration for Kolibri",
"repository": {
"type": "git",
Expand All @@ -15,15 +15,11 @@
"kolibri-build": "./src/cli.js"
},
"dependencies": {
"@babel/core": "^7.29.0",
"@babel/plugin-syntax-import-assertions": "^7.27.1",
"@babel/plugin-transform-runtime": "^7.29.0",
"@babel/preset-env": "^7.29.2",
"@swc/core": "^1.11.29",
"swc-loader": "^0.2.6",
"autoprefixer": "10.4.23",
"babel-loader": "^10.1.1",
"browserslist-config-kolibri": "0.18.0",
"commander": "^14.0.3",
"core-js": "^3",
"css-loader": "7.1.2",
"css-minimizer-webpack-plugin": "7.0.4",
"enhanced-resolve": "^5.20.1",
Expand Down
18 changes: 13 additions & 5 deletions packages/kolibri-build/src/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,23 @@ module.exports = ({ mode = 'development', hot = false, cache = false, transpile
if (transpile) {
rules.push({
test: /\.(js|mjs)$/,
loader: require.resolve('babel-loader'),
loader: require.resolve('swc-loader'),
exclude: [
// From: https://webpack.js.org/loaders/babel-loader/#exclude-libraries-that-should-not-be-transpiled
// \\ for Windows, / for macOS and Linux
/node_modules[\\/]core-js/,
/node_modules[\\/]webpack[\\/]buildin/,
],
options: {
cacheDirectory: cache,
cacheCompression: false,
env: {
targets: require('browserslist-config-kolibri'),
},
jsc: {
parser: {
syntax: 'ecmascript',
importAssertions: true,
},
},
},
});
}
Expand All @@ -108,9 +115,10 @@ module.exports = ({ mode = 'development', hot = false, cache = false, transpile
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
minify: TerserPlugin.swcMinify,
terserOptions: {
// Don't specify mangle, as it is true by default.
compress: true,
mangle: true,
output: {
comments: false,
},
Expand Down
18 changes: 13 additions & 5 deletions packages/kolibri-jest-config/jest.conf/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
const babelConfig = require('kolibri-build/babel.config');

babelConfig.plugins.push('@babel/plugin-transform-runtime');

module.exports = babelConfig;
module.exports = {
presets: [
[
'@babel/preset-env',
{
useBuiltIns: 'entry',
corejs: '3.31',
},
],
],
plugins: ['@babel/plugin-syntax-import-assertions', '@babel/plugin-transform-runtime'],
sourceType: 'unambiguous',
};
5 changes: 4 additions & 1 deletion packages/kolibri-jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
"private": false,
"main": "jest.conf/index.js",
"dependencies": {
"@babel/core": "^7.29.0",
"@babel/plugin-syntax-import-assertions": "^7.27.1",
"@babel/plugin-transform-runtime": "^7.29.0",
"@babel/preset-env": "^7.29.2",
"aphrodite": "^2.4.0",
"core-js": "^3",
"intl": "^1.2.4",
"kolibri": "workspace:*",
"kolibri-build": "workspace:*",
"kolibri-design-system": "catalog:",
"kolibri-logging": "workspace:*",
"regenerator-runtime": "^0.14.1",
Expand Down
Loading
Loading