Skip to content

Commit

Permalink
chore(build): compile rollup with swc
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerard Brull committed Sep 21, 2020
1 parent 2d3e6e5 commit 28ba27c
Show file tree
Hide file tree
Showing 4 changed files with 172 additions and 386 deletions.
2 changes: 1 addition & 1 deletion etc/jest/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
transform: {
'^.+\\.(t|j)sx?$': ['@swc/jest'],
'^.+\\.css$': '<rootDir>/../etc/jest/cssTransform.js',
'^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)': '<rootDir>/../etc/jest/fileTransform.js',
'^(?!.*\\.(mjs|cjs|css|json)$)': '<rootDir>/../etc/jest/fileTransform.js',
},
transformIgnorePatterns: [
'[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|cjs|ts|tsx)$',
Expand Down
18 changes: 10 additions & 8 deletions etc/rollup/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import pkg from '../../package.json';
// Plugins
import customResolveOptions from '@rollup/plugin-node-resolve';
import url from '@rollup/plugin-url';
import babel from '@rollup/plugin-babel';
import swc from 'rollup-plugin-swc';
import commonjs from '@rollup/plugin-commonjs';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import styles from 'rollup-plugin-styles';

const extensions = ['.ts', '.tsx', '.js', '.json'];

Expand All @@ -32,11 +32,14 @@ export default {
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})],
plugins: [
customResolveOptions({ extensions }),
babel({
presets: [['react-app', { flow: false, typescript: true, absoluteRuntime: false }]],
babelHelpers: 'runtime',
extensions,
exclude: 'node_modules',
styles(),
swc({
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
}),
commonjs({
include: /node_modules/,
Expand All @@ -47,6 +50,5 @@ export default {
emitFiles: true, // defaults to true
}),
terser(),
postcss({ minimize: true }),
],
};
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@
"typescript": ">=3.x <4"
},
"devDependencies": {
"@babel/runtime": "7.10.4",
"@commitlint/cli": "8.3.5",
"@commitlint/config-conventional": "8.3.4",
"@fortawesome/free-solid-svg-icons": "5.13.1",
"@rollup/plugin-babel": "5.0.4",
"@rollup/plugin-commonjs": "12.0.0",
"@rollup/plugin-node-resolve": "8.1.0",
"@rollup/plugin-url": "5.0.1",
Expand Down Expand Up @@ -90,7 +88,6 @@
"husky": "4.2.5",
"jest": "^26.4.2",
"jest-axe": "3.3.0",
"jest-environment-jsdom-sixteen": "1.0.3",
"jest-junit": "10.0.0",
"jest-styled-components": "6.3.4",
"lint-staged": "10.2.11",
Expand All @@ -101,7 +98,8 @@
"react-styleguidist": "11.0.8",
"react-test-renderer": "16.13.1",
"rollup": "2.21.0",
"rollup-plugin-postcss": "3.1.2",
"rollup-plugin-styles": "^3.10.0",
"rollup-plugin-swc": "^0.1.4",
"rollup-plugin-terser": "6.1.0",
"semantic-release": "17.1.1",
"style-loader": "^1.2.1",
Expand Down

0 comments on commit 28ba27c

Please sign in to comment.