Skip to content

Commit

Permalink
chore: upgrade parcel to v2 (alpha) (#96)
Browse files Browse the repository at this point in the history
parcel v1 had some trouble with node modules that are importing core-js polyfills.
  • Loading branch information
smeijer authored Jun 5, 2020
1 parent a35b58c commit 82b694e
Show file tree
Hide file tree
Showing 10 changed files with 4,759 additions and 6,879 deletions.
5 changes: 4 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"presets": ["@babel/preset-react","@babel/preset-env"]
"presets": [
"@babel/preset-react",
"@babel/preset-env"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.rts2_cache*
.idea
.cache
.parcel-cache

dist/
node_modules/

Expand Down
7 changes: 7 additions & 0 deletions .parcelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": ["@parcel/config-default"],
"transformers": {
"*.pcss": ["@parcel/transformer-postcss"],
"*.css": ["@parcel/transformer-postcss"],
},
}
11,596 changes: 4,729 additions & 6,867 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
"name": "testing-playground",
"version": "1.0.0",
"description": "",
"main": "src/index.html",
"scripts": {
"start": "run-s start:client",
"start:client": "parcel src/index.html --out-dir dist/client",
"start:client": "parcel src/index.html --open",
"start:embed": "parcel src/embed.html --open",
"build": "run-s clean build:client build:server",
"build:client": "parcel build src/index.html src/embed.js --out-dir dist/client",
"build:client": "parcel build src/index.html src/embed.js --dist-dir dist/client",
"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",
"build:server": "cp -r src/lambda/ dist/server",
"postbuild:server": "mkdir -p dist/server/server && mv dist/client/index.html dist/server/server/",
Expand Down Expand Up @@ -50,8 +49,8 @@
"jest": "^26.0.1",
"lint-staged": "^10.2.2",
"npm-run-all": "^4.1.5",
"parcel-bundler": "^1.6.1",
"postcss-easy-import": "^3.0.0",
"parcel": "^2.0.0-nightly.280",
"postcss-import": "^12.0.1",
"postcss-modules": "^2.0.0",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
Expand Down
6 changes: 3 additions & 3 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const tailwindcss = require('tailwindcss');
const easyImport = require('postcss-easy-import');
const atImport = require('postcss-import');

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

const plugins = [easyImport, tailwindcss];
const plugins = [atImport, tailwindcss];

if (!IS_DEVELOPMENT) {
const purgecss = require('@fullhuman/postcss-purgecss');
Expand All @@ -18,7 +18,7 @@ if (!IS_DEVELOPMENT) {
purgecss({
content: ['src/*.html', 'src/**/*.js'],
whitelist: ['body', /CodeMirror/],
whitelistPatternsChildren: [/CodeMirror/],
whitelistPatternsChildren: [/CodeMirror/, /cm-s-dracula/],
defaultExtractor: TailwindExtractor.extract,
}),
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/AddHtml.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import icon from '../../public/code_thinking.png';
import icon from 'url:~/public/code_thinking.png';

function AddHtml() {
return (
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import icon from '../../public/favicon-32x32.png';
import icon from 'url:~/public/favicon-32x32.png';
import { links } from '../constants';

const headerLinks = [
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<title>Testing Playground</title>
<link rel="stylesheet" href="styles/app.pcss" />
<link rel="stylesheet" href="styles/index.css" />

<link rel="apple-touch-icon" sizes="180x180" href="../public/apple-touch-icon.png">
<link rel="shortcut icon" type="image/x-icon" href="../public/favicon.ico">
Expand Down
7 changes: 7 additions & 0 deletions src/styles/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* Don't rename this file to .pcss, parcel 2 doesn't change the extension, and
* browers won't recognize the mime type. We keep using the correct extension
* for other files to enable proper syntax highlighting.
*/
@import './app.pcss';
@import './codemirror.pcss';

0 comments on commit 82b694e

Please sign in to comment.