Skip to content

Commit 82b694e

Browse files
authored
chore: upgrade parcel to v2 (alpha) (#96)
parcel v1 had some trouble with node modules that are importing core-js polyfills.
1 parent a35b58c commit 82b694e

File tree

10 files changed

+4759
-6879
lines changed

10 files changed

+4759
-6879
lines changed

.babelrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"presets": ["@babel/preset-react","@babel/preset-env"]
2+
"presets": [
3+
"@babel/preset-react",
4+
"@babel/preset-env"
5+
]
36
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
.rts2_cache*
22
.idea
33
.cache
4+
.parcel-cache
5+
46
dist/
57
node_modules/
68

.parcelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["@parcel/config-default"],
3+
"transformers": {
4+
"*.pcss": ["@parcel/transformer-postcss"],
5+
"*.css": ["@parcel/transformer-postcss"],
6+
},
7+
}

package-lock.json

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

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
"name": "testing-playground",
33
"version": "1.0.0",
44
"description": "",
5-
"main": "src/index.html",
65
"scripts": {
76
"start": "run-s start:client",
8-
"start:client": "parcel src/index.html --out-dir dist/client",
7+
"start:client": "parcel src/index.html --open",
98
"start:embed": "parcel src/embed.html --open",
109
"build": "run-s clean build:client build:server",
11-
"build:client": "parcel build src/index.html src/embed.js --out-dir dist/client",
10+
"build:client": "parcel build src/index.html src/embed.js --dist-dir dist/client",
1211
"postbuild:client": "mkdir -p dist/client/public && cp _redirects dist/client/_redirects && cp public/favicon.ico dist/client/favicon.ico && cp public/android-chrome-512x512.png dist/client/public/icon.png && cp -r .well-known dist/client/.well-known",
1312
"build:server": "cp -r src/lambda/ dist/server",
1413
"postbuild:server": "mkdir -p dist/server/server && mv dist/client/index.html dist/server/server/",
@@ -50,8 +49,8 @@
5049
"jest": "^26.0.1",
5150
"lint-staged": "^10.2.2",
5251
"npm-run-all": "^4.1.5",
53-
"parcel-bundler": "^1.6.1",
54-
"postcss-easy-import": "^3.0.0",
52+
"parcel": "^2.0.0-nightly.280",
53+
"postcss-import": "^12.0.1",
5554
"postcss-modules": "^2.0.0",
5655
"prettier": "^2.0.5",
5756
"rimraf": "^3.0.2",

postcss.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
const tailwindcss = require('tailwindcss');
2-
const easyImport = require('postcss-easy-import');
2+
const atImport = require('postcss-import');
33

44
const IS_DEVELOPMENT = process.env.NODE_ENV === 'development';
55

6-
const plugins = [easyImport, tailwindcss];
6+
const plugins = [atImport, tailwindcss];
77

88
if (!IS_DEVELOPMENT) {
99
const purgecss = require('@fullhuman/postcss-purgecss');
@@ -18,7 +18,7 @@ if (!IS_DEVELOPMENT) {
1818
purgecss({
1919
content: ['src/*.html', 'src/**/*.js'],
2020
whitelist: ['body', /CodeMirror/],
21-
whitelistPatternsChildren: [/CodeMirror/],
21+
whitelistPatternsChildren: [/CodeMirror/, /cm-s-dracula/],
2222
defaultExtractor: TailwindExtractor.extract,
2323
}),
2424
);

src/components/AddHtml.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import icon from '../../public/code_thinking.png';
2+
import icon from 'url:~/public/code_thinking.png';
33

44
function AddHtml() {
55
return (

src/components/Header.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import icon from '../../public/favicon-32x32.png';
2+
import icon from 'url:~/public/favicon-32x32.png';
33
import { links } from '../constants';
44

55
const headerLinks = [

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<title>Testing Playground</title>
6-
<link rel="stylesheet" href="styles/app.pcss" />
6+
<link rel="stylesheet" href="styles/index.css" />
77

88
<link rel="apple-touch-icon" sizes="180x180" href="../public/apple-touch-icon.png">
99
<link rel="shortcut icon" type="image/x-icon" href="../public/favicon.ico">

src/styles/index.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Don't rename this file to .pcss, parcel 2 doesn't change the extension, and
3+
* browers won't recognize the mime type. We keep using the correct extension
4+
* for other files to enable proper syntax highlighting.
5+
*/
6+
@import './app.pcss';
7+
@import './codemirror.pcss';

0 commit comments

Comments
 (0)