rm -rf .cache && rm -rf public && gatsby-build
์คํ์ 2.0.83์์ ์ ์๋ํฉ๋๋ค. 2.0.84๋ก ์
๊ทธ๋ ์ด๋ ํ ํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ฌ ๋น๋๊ฐ ์ค๋จ๋ฉ๋๋ค.
๋ด๊ฐ ์ทจํ๋ ์ ์ผํ ๊ฒ์ gatsby build
์
๋๋ค. 2.0.83์ผ๋ก ๋ค์ ๋ค์ด ๊ทธ๋ ์ด๋ํ๋ฉด ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ง๋๋ค.
๋น๋๊ฐ ์ฑ๊ณต์ ์ผ๋ก ์๋ฃ๋์ด์ผํฉ๋๋ค.
๋ค์ ์ค๋ฅ์ ํจ๊ป ๋น๋๊ฐ ์ข ๋ฃ๋ฉ๋๋ค.
success onPostBootstrap โ 0.202 s
info bootstrap finished - 6.171 s
error Generating JavaScript bundles failed
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---node-modules-gatsby-plugin-offline-app-shell-js": function componentNodeModulesGatsbyPluginOfflineAppShellJs() {
> return import("/Users/dereklindahl/Work/APP/node_modules/gatsby-plugin-offline/app-shell.js"
| /* webpackChunkName: "component---node-modules-gatsby-plugin-offline-app-shell-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
npx gatsby info -- --clipboard
System:
OS: macOS High Sierra 10.13.6
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 5.4.2 - /usr/local/bin/zsh
Binaries:
Node: 10.14.0 - ~/.nodenv/versions/10.14.0/bin/node
Yarn: 1.12.3 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nodenv/versions/10.14.0/bin/npm
Languages:
Python: 2.7.10 - /usr/bin/python
Browsers:
Chrome: 71.0.3578.98
Firefox: 63.0.3
Safari: 12.0.2
npmPackages:
gatsby: 2.0.84 => 2.0.84
gatsby-image: ^2.0.25 => 2.0.25
gatsby-mdx: ^0.2.0 => 0.2.0
gatsby-plugin-canonical-urls: ^2.0.8 => 2.0.8
gatsby-plugin-google-analytics: ^2.0.8 => 2.0.8
gatsby-plugin-manifest: ^2.0.13 => 2.0.13
gatsby-plugin-netlify: ^2.0.6 => 2.0.6
gatsby-plugin-netlify-cache: ^1.0.0 => 1.0.0
gatsby-plugin-offline: ^2.0.21 => 2.0.21
gatsby-plugin-react-helmet: ^3.0.5 => 3.0.5
gatsby-plugin-sharp: ^2.0.17 => 2.0.17
gatsby-plugin-sitemap: ^2.0.4 => 2.0.4
gatsby-plugin-sri: ^1.0.4 => 1.0.4
gatsby-plugin-styled-components: ^3.0.4 => 3.0.4
gatsby-plugin-zopfli: ^1.0.2 => 1.0.2
gatsby-source-filesystem: ^2.0.12 => 2.0.12
gatsby-transformer-sharp: ^2.1.10 => 2.1.10
์ต์ํ๊ฒ ๋ค๋ฆฌ๋ # 10038์ ๋ณด์์ง๋ง ๋ด Webpack ๊ตฌ์ฑ์ ํฅ๋ฏธ๋กญ์ง ์์ต๋๋ค.
// gatsby-node.js
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
module: {
rules: [
{
test: /\.ogv$/,
use: [
{
loader: require.resolve(`url-loader`),
options: { limit: 10000, name: 'static/[name]-[hash].[ext]' }
}
]
}
]
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src/components')
},
modules: [path.resolve(__dirname, 'src'), 'node_modules']
}
})
}
๊ทธ๋ฆฌ๊ณ ๊ทธ ์ฐจ๋จ์ ์ฃผ์ ์ฒ๋ฆฌํด๋ ์ค๋ฅ๊ฐ ์์ ๋์ง ์์ต๋๋ค.
gatsby-plugin-offline
๋ฅผ gatsby-plugin-remove-serviceworker
๋ฐ๊พธ๋ฉด ๋ฌธ์ ๊ฐ ๋จ์ ์์ง๋ง ๋น๋๊ธฐ ๊ฐ์ ธ ์ค๊ธฐ๊ฐ ๋ค๋ฆ
๋๋ค.
FWIW, 2.0.83 ๋๋ 2.0.84 ๋น๋์์ async-require.js
์ ๋ด์ฉ์ ์ฐจ์ด๊ฐ ์์์ ์ ์ ์์ผ๋ฉฐ gatsby-plugin-offline
์
๊ทธ๋ ์ด๋ํด๋ ์๋ฌด๋ฐ ์ฐจ์ด๊ฐ ์์ต๋๋ค.
2.0.62
์์ 2.0.91
์
๊ทธ๋ ์ด๋ ํ ํ์๋ ๋น์ทํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ ๊ฒฝ์ฐ์๋ gatsby develop
๊ฐ ์ ๋๋ก ์๋ํ์ง๋ง gatsby build
template.js
ํ์ด์ง (ํฌํจํ๋ ๊ฒฝ์ฐ) ๋๋ 404.js
( createPages
์ค ๋ํซ ( gatsby-node
) :
error Generating JavaScript bundles failed
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---src-templates-template-js": function componentSrcTemplatesTemplateJs() {
> return import("/Users/michael/Sites/projects/gatsby-starter/src/templates/template.js"
| /* webpackChunkName: "component---src-templates-template-js" */ | );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
๋๋
error Generating JavaScript bundles failed
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---src-pages-404-js": function componentSrcPages404Js() {
> return import("/Users/michael/Sites/projects/gatsby-starter/src/pages/404.js"
| /* webpackChunkName: "component---src-pages-404-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
gatsby
์
๊ทธ๋ ์ด๋ํ๊ธฐ ์ ์ ๋ชจ๋ ๊ฒ์ด ์ ์๋ํ์ต๋๋ค. ๐คทโโ๏ธ
ํธ์ ๋ด์ ๊ฐ๊ธฐ
์ด๊ฒ์ ์ต์ํ์ ๋ณต์ ์ ์ฐ๊ฒฐํด ์ฃผ์๊ฒ ์ต๋๊น?
.npmrc์์ package-lock.json์ด ๋นํ์ฑํ ๋ Gatsby v 2.0.55๋ฅผ ์ฌ์ฉํ์ฌ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด ์ฌ์ดํธ๋ ๋งค์ผ ๊นจ๋ํ ์์ ๊ณต๊ฐ์์ ์ง์ด์ก์ต๋๋ค. ์ด๋ ๋ ์ ํจ๊ณผ๊ฐ ์์์ง๋ง ๋ค์ ๋ ์ ๊ทธ๋ ์ง ์์์ต๋๋ค. ์ค๋ฅ๊ฐ ๋ณ๊ฒฝ๋ ์ผ์์ ์ธ ์ข ์์ฑ๊ณผ ๊ด๋ จ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
gatsby
์ v2.0.91
์์ v2.0.93
( v2.0.92
)๋ก ์
๊ทธ๋ ์ด๋ ํ ๋ ๋์ผํ ๋ฌธ์ ๊ฐ ์กด์ฌํ์ง ์์ต๋๋ค.
์๋ ํ์ธ์, ์ ๋ ํ์ฌ์ด ๋ฌธ์ ๋ฅผ ๊ฒช๊ณ ์์ง๋ง ์ต์ํ์ ์ฌ์์ฐ์ ๊ตฌ์ถํ๋ ๋ฐ ์ด๋ ค์์ ๊ฒช๊ณ ์๋ค๊ณ ๋งํฉ๋๋ค.
ํ์ฌ ๋ด ์ ์ฅ์ ์์ npm update
๋ฅผ ์คํํ๋ฉด ๋น๋๊ฐ ์คํจํ์ง๋ง ๋ด ๊ฐ์ธ ์น ์ฌ์ดํธ ์๋ ์ ์ฉ๋์ง ์์ต๋๋ค.
์์ธ์ ์ฐพ์ ๋๊น์ง ๋๋ ๋ค๋ฅธ ์ฌ๋์ด ์์๋ผ ๋๊น์ง ๊ณ์ํด์ ํํค์น ๊ฒ์ ๋๋ค. ๊นจ๋ํ๊ฒ ๋ถ๋ฆฌ ํ ์ โโ์๋ค๋ฉด ์ฌ๊ธฐ์ ๋ค์ ๊ฒ์ํ๊ฒ ์ต๋๋ค.
๊ฐ์ฌ!
์ฌ๊ธฐ๋ ๋ง์ฐฌ๊ฐ์ง์
๋๋ค!
npm 6.7.0 ๋ฒ์ ์ ์ป๊ธฐ ์ํด npm update -g npm
๋ฅผ ์
๋ ฅํ๊ณ gatsby 2.0.98์ด ์์ต๋๋ค.
๊ฐ์ธ ๋น ํ๋ฌ๊ทธ์ธ ์คํ๋ผ์ธ ๋ฒ์ -> 2.0.21
์ด ๋ฌธ์ ๊ฐ์๋ ์ ์ฅ์ : ์์ ํฉ๋๋ค .
๋ํ ๋น์ ๊ณผ ํจ๊ป ์ค์น ์ข
์์ฑ์ ํ์ ํ ์ ์์ต๋๋ค npm ls
์คํ node --version
?
์ด๋ฑ๋ถ์ ์ฌ๊ธฐ์๋ ๋์์ด ๋ ์ ์์ต๋๋ค. ๋ช ๋ถ ์์ ๋ฆฌํฌ์งํ ๋ฆฌ๋ฅผ ํ ์คํธํ๊ฒ ์ต๋๋ค.
์ฌ๊ธฐ์ ๊ฐ์ ์ค๋ฅ๊ฐ ์์ต๋๋ค. ๋๋ ์ด๊ฒ์ ์ด๋ฑ๋ถ ํ ๊ฒ์ด๋ค.
๋ชจ๋ ๋ฒ์ ์์ ๋ฐ์ํ๋ ๊ฒ์ผ๋ก ๋ณด์ด๋ฏ๋ก ์๋ง๋ ํ๋ฌ๊ทธ์ธ ๋๋ ๋ค๋ฅธ ์ข
์์ฑ ์ผ ๊ฒ์
๋๋ค.
๋ ํ
์คํธ ํ ๊ฒ์
๋๋ค.
์์ธ์ ์ฐพ์ ๊ฒ ๊ฐ์ต๋๋ค. ํจ์น์ PR์ ์ ๊ณตํ๊ฒ ์ต๋๋ค.
@omrllm (๊ฐ์ธ ๋น 2.0.60 ์ฉ ํจ์น)
patch-package
--- a/node_modules/gatsby/dist/internal-plugins/query-runner/pages-writer.js
+++ b/node_modules/gatsby/dist/internal-plugins/query-runner/pages-writer.js
@@ -86,9 +86,9 @@ const preferDefault = m => m && m.default || m
let asyncRequires = `// prefer default export if available
const preferDefault = m => m && m.default || m
\n`;
- asyncRequires += `exports.components = {\n${components.map(c => ` "${c.componentChunkName}": () => import("${(0, _path.joinPath)(c.component)}" /* webpackChunkName: "${c.componentChunkName}" */)`).join(`,\n`)}
+ asyncRequires += `exports.components = {\n${components.map(c => ` "${c.componentChunkName}": () => require("${(0, _path.joinPath)(c.component)}" /* webpackChunkName: "${c.componentChunkName}" */)`).join(`,\n`)}
}\n\n`;
- asyncRequires += `exports.data = () => import("${(0, _path.joinPath)(program.directory, `.cache`, `data.json`)}")\n\n`;
+ asyncRequires += `exports.data = () => require("${(0, _path.joinPath)(program.directory, `.cache`, `data.json`)}")\n\n`;
const writeAndMove = (file, data) => {
const destination = (0, _path.joinPath)(program.directory, `.cache`, file);
import
๋ฅผ require
๋ณ๊ฒฝํ๋ฉด ์๋ํฉ๋๋ค. ์๋ง๋ ๋๋ฝ ๋ ๋ก๋๊ฐ์์ ์ ์์ง๋ง ESM ๋ฐฉ์์ด ๋ฌธ์ ๋ฅผ ์์ฑํ๊ณ exports
์ import
ํผํฉํ๋ ๊ฒ์ ๊ฒฐ์ฝ ์ข์ ์๊ฐ์ด ์๋๋ฐ ์ฌ๊ธฐ์ import
์ฌ์ฉํ๋ ์ด์ ์
๋๋ค.
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
+ [email protected]
added 9 packages from 3 contributors, removed 4 packages, updated 92 packages and audited 43569 packages in 200.269s
diff 23.cache/ .cache/
Only in 23.cache/: .sonarlint
Common subdirectories: 23.cache/__tests__ and .cache/__tests__
Common subdirectories: 23.cache/caches and .cache/caches
Common subdirectories: 23.cache/commonjs and .cache/commonjs
diff 23.cache/data.json .cache/data.json
1c1
< {"pages":[{"componentChunkName":"component---src-pages-index-js","jsonName":"index","path":"/"},{"componentChunkName":"component---src-pages-404-js","jsonName":"404-html-516","path":"/404.html"},{"componentChunkName":"component---src-pages-404-js","jsonName":"404-22d","path":"/404/"},{"componentChunkName":"component---src-pages-about-js","jsonName":"about-f34","path":"/about/"},{"componentChunkName":"component---src-pages-contact-js","jsonName":"contact-26a","path":"/contact/"}],"dataPaths":{"404-22d":"657/path---404-22-d-bce-yc2HAWbdDECy3NCKIhFOCg1lY8","404-html-516":"84/path---404-html-516-62a-yc2HAWbdDECy3NCKIhFOCg1lY8","about-f34":"691/path---about-f-34-4c2-WV9OHhcgC975Z2f0az9WK5Dpl0Y","contact-26a":"662/path---contact-26-a-cd9-SNoLKPyPsqQ59X6yAuuT79ALOJc","index":"612/path---index-6a9-j0JKW3rrllGOOtWKwyNn0ujHMk"}}
\ No newline at end of file
---
> {"pages":[{"componentChunkName":"component---src-pages-index-js","jsonName":"index","path":"/"},{"componentChunkName":"component---src-pages-404-js","jsonName":"404-html-516","path":"/404.html"},{"componentChunkName":"component---src-pages-404-js","jsonName":"404-22d","path":"/404/"},{"componentChunkName":"component---src-pages-about-js","jsonName":"about-f34","path":"/about/"},{"componentChunkName":"component---src-pages-contact-js","jsonName":"contact-26a","path":"/contact/"}],"dataPaths":{"404-22d":"657/path---404-22-d-bce-yc2HAWbdDECy3NCKIhFOCg1lY8","404-html-516":"84/path---404-html-516-62a-yc2HAWbdDECy3NCKIhFOCg1lY8","about-f34":"691/path---about-f-34-4c2-WV9OHhcgC975Z2f0az9WK5Dpl0Y","contact-26a":"662/path---contact-26-a-cd9-SNoLKPyPsqQ59X6yAuuT79ALOJc","index":"770/path---index-6a9-dVi4vZoL0B52PVt3C79b9kQk"}}
\ No newline at end of file
diff 23.cache/default-html.js .cache/default-html.js
4,31c4,29
< export default class HTML extends React.Component {
< render() {
< return (
< <html {...this.props.htmlAttributes}>
< <head>
< <meta charSet="utf-8" />
< <meta httpEquiv="x-ua-compatible" content="ie=edge" />
< <meta
< name="viewport"
< content="width=device-width, initial-scale=1, shrink-to-fit=no"
< />
< {this.props.headComponents}
< </head>
< <body {...this.props.bodyAttributes}>
< {this.props.preBodyComponents}
< <noscript key="noscript" id="gatsby-noscript">
< This app works best with JavaScript enabled.
< </noscript>
< <div
< key={`body`}
< id="___gatsby"
< dangerouslySetInnerHTML={{ __html: this.props.body }}
< />
< {this.props.postBodyComponents}
< </body>
< </html>
< )
< }
---
> export default function HTML(props) {
> return (
> <html {...props.htmlAttributes}>
> <head>
> <meta charSet="utf-8" />
> <meta httpEquiv="x-ua-compatible" content="ie=edge" />
> <meta
> name="viewport"
> content="width=device-width, initial-scale=1, shrink-to-fit=no"
> />
> {props.headComponents}
> </head>
> <body {...props.bodyAttributes}>
> {props.preBodyComponents}
> <noscript key="noscript" id="gatsby-noscript">
> This app works best with JavaScript enabled.
> </noscript>
> <div
> key={`body`}
> id="___gatsby"
> dangerouslySetInnerHTML={{ __html: props.body }}
> />
> {props.postBodyComponents}
> </body>
> </html>
> )
Common subdirectories: 23.cache/fragments and .cache/fragments
Common subdirectories: 23.cache/json and .cache/json
diff 23.cache/navigation.js .cache/navigation.js
37c37
< const onPreRouteUpdate = location => {
---
> const onPreRouteUpdate = (location, prevLocation) => {
39c39
< apiRunner(`onPreRouteUpdate`, { location })
---
> apiRunner(`onPreRouteUpdate`, { location, prevLocation })
43c43
< const onRouteUpdate = location => {
---
> const onRouteUpdate = (location, prevLocation) => {
45c45
< apiRunner(`onRouteUpdate`, { location })
---
> apiRunner(`onRouteUpdate`, { location, prevLocation })
136c136
< onPreRouteUpdate(props.location)
---
> onPreRouteUpdate(props.location, null)
140c140
< onRouteUpdate(this.props.location)
---
> onRouteUpdate(this.props.location, null)
145c145
< onRouteUpdate(this.props.location)
---
> onRouteUpdate(this.props.location, prevProps.location)
151c151
< onPreRouteUpdate(this.props.location)
---
> onPreRouteUpdate(this.props.location, prevProps.location)
diff 23.cache/static-entry.js .cache/static-entry.js
55c55,59
< <meta name="generator" content={`Gatsby ${gatsbyVersion}`} />,
---
> <meta
> name="generator"
> content={`Gatsby ${gatsbyVersion}`}
> key={`generator-${gatsbyVersion}`}
> />,
354,360c358,366
< const bodyScripts = scripts.filter(s => s.rel !== `prefetch`).map(s => {
< const scriptPath = `${__PATH_PREFIX__}/${JSON.stringify(s.name).slice(
< 1,
< -1
< )}`
< return <script key={scriptPath} src={scriptPath} async />
< })
---
> const bodyScripts = scripts
> .filter(s => s.rel !== `prefetch`)
> .map(s => {
> const scriptPath = `${__PATH_PREFIX__}/${JSON.stringify(s.name).slice(
> 1,
> -1
> )}`
> return <script key={scriptPath} src={scriptPath} async />
> })
์ ๋ฐ์ดํธ ํ๋ก๊ทธ๋จ๊ณผ ์ ๋น๋ ์คํ ํ ์ฐจ์ด @madelyneriksen
patch-package
--- a/node_modules/gatsby/dist/internal-plugins/query-runner/pages-writer.js
+++ b/node_modules/gatsby/dist/internal-plugins/query-runner/pages-writer.js
@@ -88,9 +88,9 @@ const preferDefault = m => m && m.default || m
let asyncRequires = `// prefer default export if available
const preferDefault = m => m && m.default || m
\n`;
- asyncRequires += `exports.components = {\n${components.map(c => ` "${c.componentChunkName}": () => import("${(0, _path.joinPath)(c.component)}" /* webpackChunkName: "${c.componentChunkName}" */)`).join(`,\n`)}
+ asyncRequires += `exports.components = {\n${components.map(c => ` "${c.componentChunkName}": () => require("${(0, _path.joinPath)(c.component)}" /* webpackChunkName: "${c.componentChunkName}" */)`).join(`,\n`)}
}\n\n`;
- asyncRequires += `exports.data = () => import(/* webpackChunkName: "pages-manifest" */ "${(0, _path.joinPath)(program.directory, `.cache`, `data.json`)}")\n\n`;
+ asyncRequires += `exports.data = () => require(/* webpackChunkName: "pages-manifest" */ "${(0, _path.joinPath)(program.directory, `.cache`, `data.json`)}")\n\n`;
const writeAndMove = (file, data) => {
const destination = (0, _path.joinPath)(program.directory, `.cache`, file);
์ด๊ฒ์ .98์์ ์๋ํฉ๋๋ค.
์๋ง๋ ๋ด๊ฐ ์๋ชป๋ ๊ธธ์ ๊ฐ๊ณ ์๊ณ , ๋ณ๊ฒฝ์ผ๋ก ์ธํด ์คํจํ ํ ์คํธ๊ฐ ์์ฑ๋ฉ๋๋ค https://github.com/gatsbyjs/gatsby/pull/11331
์ด์ ๋ ์์ง ํ์คํ์ง ์์ต๋๋ค.
๊ทธ๋๋ ์๋์ฃ ?
๋ด๊ฐ ์ ์ํ ๋ณ๊ฒฝ์ผ๋ก ๋น๋ ์คํฌ๋ฆฝํธ๊ฐ ์ฑ๊ณตํฉ๋๋ค. ๊ทธ๋ฌ๋ ์ด๊ฒ์ด ์ฌ๋ฐ๋ฅธ ํด๊ฒฐ์ฑ ์ธ์ง ํ์คํ์ง ์์ต๋๋ค. ๊ทธ๋์ ๊ทธ๊ฒ์ ํ ์คํธํ๊ณ ๊ฒํ ํ์ญ์์ค.
ํ , ์๋๋ฉด ์๋ก์ด ์ฌ์ ์ค์ ๋๋ฌธ์
๋๊น?
https://github.com/gatsbyjs/gatsby/commit/69faca0bff0e2c04e6b3be50bba087284c3dbf6b#diff -a30bb413b08d8091d9187909b256c943
ํ๋ฌ๊ทธ์ธ ๋ฐฐ์ด์ด ์ ํํฉ๋๊น?
์๋ก์ด Gatsby ํ๋ก์ ํธ์์๋ ๋ฌธ์ ๊ฐ ๋ฐ์ํ๋ฉฐ CI ํ ์คํธ๋ฅผ ํตํด ์ฌํ ํ ์ ์์ต๋๊น?
๋๋
npm update
๊ทธ๋ฆฌ๊ณ ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ก์ต๋๋ค.
์ค์น๋ ์ข ์์ฑ ๋ชฉ๋ก์ ์ ๊ณตํ์ญ์์ค (์ ๋ฐ์ดํธ ์ ํ).
@DanielRuf , ๋๋ ๊ทธ๊ฒ์ ์ฌํ ํ ์ ์์ต๋๋ค. ๋๋ ์ฌ์ ํ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ ์ฐ์ฐ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค.
ํด๊ฒฐ ๋ฐฉ๋ฒ์ npm ์ ๊ธ ํ์ผ์ ๊ฐ์ ธ์จ ํ ์๋ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด๋ npm ๋์ Yarn์ ์ฌ์ฉํ์ฌ ์ข ์์ฑ์ ์ค์นํ๋ ๊ฒ์ ๋๋ค.
gatsby v2.0.91 (๋น๋ ์ฑ๊ณต) ๋ฐ v2.0.93 (๋น๋ ์คํจ)์์ ๋ด npm ls
๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. https://gist.github.com/cyrildurand/f4b70abff19288117ea3996500532774
์ฌ์ ํ gatsby 2.0.103์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
yarn
์ข
์์ฑ์ ์ค์นํ๋ ค๊ณ ํ์ต๋๊น?
ํํ
npm
์ ์ค์นํ ๋์ด ์ค๋ฅ๊ฐ ๋ฐ์ ํ์ต๋๊น?
๋๋ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์์ง๋ง arcon
์ ๋ฒ์ ์ 6.0์ผ๋ก ์
๊ทธ๋ ์ด๋ํ๋ฉด ์ ์๋ํ์ต๋๋ค.
npm์ ์ค์นํ ๋์ด ์ค๋ฅ๊ฐ ๋ฐ์ ํ์ต๋๊น?
์ด๋ ๊ฒฝ๊ณ ์ผ ๋ฟ์ด๋ฉฐ Gatsby ๋ฌธ์ ์ ๊ด๋ จ์ด ์์ต๋๋ค.
acorn
์ค์น ํ ๋์ผํ ์ค๋ฅ
yarn
์ ํจ๊ป ์๋ํฉ๋๋ค. yarn list
์ถ๋ ฅ์ผ๋ก ์์ ์ ์
๋ฐ์ดํธํ์ต๋๋ค.
๋ํ ๋ฆฌ ์ค์น ํ ๋์ผํ ์ค๋ฅ
์ด๋ค ์ค๋ฅ?
acorn
์
๊ทธ๋ ์ด๋๋ฅผ ์๋ํ์ต๋๋ค @ seonim-ryu๊ฐ ์ ์ํ๊ณ gatsby build
์คํ์ ์๋ํ๋๋ฐ ๋์ผํ "์๊ธฐ์น ์์ ํ ํฐ"์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค (์ด ๋ฌธ์ ์ ์ฒซ ๋ฒ์งธ ๋ฉ์์ง์์ ๊ฐ์ ธ์จ ์ค๋ฅ).
์์ฌ๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฌธ์ ๊ฐ ์ฌ๋ผ์ง๊ณ gatsby build
๋ช
๋ น์ด ์ฑ๊ณตํฉ๋๋ค.
์ด์ ๋ํ ๋ฆฌ ๋ฆด๋ฆฌ์ค์์๋ ๋ฐ์ํฉ๋๊น? ์๋๋ฉด ์ด๊ฒ์ด ์์ธ์ด ์๋๋๊น?
๋ด๊ฐ ์ ์ํ ์์ ์ฌํญ์ ์๋ ํ์ต๋๊น? ์ด๊ฒ์ด ๋ฌด์์ด๋ ๊นจ๋จ๋ฆด ์ง ํ์คํ์ง ์์ต๋๋ค.
์ด์ ๋ฒ์ ์ ๋ํ ๋ฆฌ์์๋ ์คํจํ์ง๋ง ๊ด๋ จ์ด ์๋ค๊ณ ์๊ฐํฉ๋๋ค.
์ด์ ์ข ์์ฑ์ ์ค์นํ๊ณ ์ ์ ๋ ์์ ์ฌํญ์ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
node_modules / gatsby / dist / internal-plugins / query-runner / pages-writer.js๋ก ์ด๋ํ์ฌ import(
๋ ๊ฐ๋ฅผ require(
ํ๊ณ https://github.com/gatsbyjs ์ฐธ์กฐ / gatsby / issues / 11198 # issuecomment -457915157
์์ ๊ณผ ํจ๊ป ์๋ํฉ๋๋ค.
์์ ์ผ๋ก ์ธํด ์์๋ ๊ฒ์ด ์์ต๋๊น? ์คํจํ CI ๋น๋๋ ์ข์ง ์์ต๋๋ค.
์๋ง๋ ๋ณ๋์ ๋ฌธ์ ์ผ ์ ์์ง๋ง ์ต์ Gatsby (2.0.106)๋ก ์ ๊ทธ๋ ์ด๋ํ๊ณ ๋ฌธ์ ( 'src / pages / 404.js')์ ๋ฐ๋ผ 404 ํ์ด์ง๋ฅผ ์ถ๊ฐ ํ ํ ๋น์ทํ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ๊ฐ๋ฐ์ ์ ์คํ๋์ง๋ง ๋น๋๋ ์คํจํ์ต๋๋ค.
404 ํ์ด์ง๋ฅผ ์์ฒด ํด๋ ( 'src / pages / 404 / index.js')๋ก ์ด๋ํ๋ฉด ๋ด ์ชฝ์์ ์ค๋ฅ๊ฐ ํด๊ฒฐ๋๊ณ ์์๋๋ก ์๋ํฉ๋๋ค (๋ก์ปฌ ๋ฐ Netlify ๋ฐฐํฌ์).
๋ด ์ญ์ ํ์ฌ ๋ฌธ์ ํด๊ฒฐ package-lock.json
ํ์ผ์ ์คํ npm install
. ์๋ก ์์ฑ ๋ package-lock.json
ํ์ผ์๋ ๋ง์ ์ฐจ์ด๊ฐ์์์ต๋๋ค.
์ฌ๊ธฐ์ ๋ฌด์จ ์ผ์ด ์ผ์ด๋๋์ง ์ ํํ ๋ชจ๋ฆ
๋๋ค.
๋ด๊ฐ ๊ฐ์ง ๋ช ๊ฐ์ง ๋ค๋ฅธ ์ฌ์ดํธ์์ ๋์ผํ ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ ํํ ๋์ผํ ์ข ์์ฑ ๋ฐ ๋ฒ์ ์ ๊ฐ์ง ์ผ๋ถ ... ํ๋๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ๊ณ ํ๋๋ ๊ทธ๋ ์ง ์์ต๋๋ค. ๊ทธ๊ฒ์ 2.0.98์์ ์์๋์์ผ๋ฉฐ ์ฌ์ ํ 2.0.106์์ ๋ฐ์ํ์ต๋๋ค. node_modules, .cache ๋ฐ ๊ณต์ฉ ํด๋๋ฅผ ์ ๊ฑฐํ๋ ค๊ณ ์๋ํ์ง๋ง ๋์์ด๋์ง ์์์ต๋๋ค. ๊ฐ๋ฐ์ด ์๋ ๋น๋์์๋ง ๋ฐ์ํฉ๋๋ค.
ํํ
package-lock.json์ ์ด๋ฆ์ ๋ค๋ฅธ ์ด๋ฆ์ผ๋ก ๋ฐ๊พธ๊ณ npm install
๋ชจ๋ ๊ฒ์ ํธ์งํ์ง๋ง ๋ค์ ์ป์์ต๋๋ค.
error Generating JavaScript bundles failed
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---node-modules-gatsby-plugin-offline-app-shell-js": function componentNodeModulesGatsbyPluginOfflineAppShellJs() {
> return import("/home/foldername/abcrypto/node_modules/gatsby-plugin-offline/app-shell.js"
| /* webpackChunkName: "component---node-modules-gatsby-plugin-offline-app-shell-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
node_modules
ํด๋๋ฅผ ์ฒญ์ ํ์ต๋๊น?
์ด๋ป๊ฒํ๋์? :(
npm prune node_modules
?
์๋๋ฉด node_modules ํด๋ ์์ ๋ชจ๋ ๊ฒ์ ์๋์ผ๋ก ์ญ์ ํฉ๋๊น?
ํธ์ง : node_modules ํด๋์ ์ด๋ฆ์ ๋ณ๊ฒฝํ์ผ๋ฉฐ ์ด์ ์๋ํฉ๋๋ค : +1 :
npm install
๊ฐ์ฌํฉ๋๋ค @cyrildurand
@DanielRuf ์ ์ ํ์ ํธ์ง ๋จ
๋ฐฑ์ ์ ์ํด ์ด๋ฆ์ ๋ณ๊ฒฝํ์ญ์์ค.
๊ทธ๋ ๋ค๋ฉด ์ ๋ง ์ค๋๋ ์ข ์์ฑ์ ๋ํ ๋ฌธ์ ์ ๋๊น?
๋ ธ๋ ๋ชจ๋์ ์ฌ๋ฌ ๋ฒ ์ญ์ ํ๋๋ฐ ์์ ๋์ง ์์์ต๋๋ค. ํจ๊ณผ๊ฐ ์์๋ ๊ฒ์ ์์ฌ ๋๋ ์์ ํจ์น ํ์ผ๋ฟ์ ๋๋ค.
@krazik ๋ฐ package-lock.json์ ์ญ์ / ์ด๋ฆ ๋ณ๊ฒฝ ํ์ต๋๊น?
์
๋ค์ ์๋ํ๋์ง ํ์ธํ๊ณ ๋ ๋ค ์ญ์ ํ๋ฉด ์์ ์ค๋ฅ๋ฅผ ์ง๋์น ์ ์์ง๋ง ์ด์ ๋
์ค๋ฅ : 'core-js / modules / es6.regexp.to-string'๋ชจ๋์ ์ฐพ์ ์ ์์ต๋๋ค.
์ค๋ฅ : 'core-js / modules / es6.regexp.to-string'๋ชจ๋์ ์ฐพ์ ์ ์์ต๋๋ค.
๋น๋์ ๊ฐ๋ฐ ๋ชจ๋๋ฅผ ์ํด.
error Cannot find module 'core-js/modules/es6.regexp.to-string'
Error: Cannot find module 'core-js/modules/es6.regexp.to-string'
- loader.js:611 Function.Module._resolveFilename
internal/modules/cjs/loader.js:611:15
- loader.js:537 Function.Module._load
internal/modules/cjs/loader.js:537:25
- loader.js:665 Module.require
internal/modules/cjs/loader.js:665:17
- helpers.js:20 require
internal/modules/cjs/helpers.js:20:18
- render-page.js:3 webpackUniversalModuleDefinition
/Users/rylanhazelton/dev/Admin/public/render-page.js:3:170
- render-page.js:10 Object.<anonymous>
/Users/rylanhazelton/dev/Admin/public/render-page.js:10:3
- loader.js:736 Module._compile
internal/modules/cjs/loader.js:736:30
- loader.js:747 Object.Module._extensions..js
internal/modules/cjs/loader.js:747:10
- loader.js:628 Module.load
internal/modules/cjs/loader.js:628:32
- loader.js:568 tryModuleLoad
internal/modules/cjs/loader.js:568:12
- loader.js:560 Function.Module._load
internal/modules/cjs/loader.js:560:3
- loader.js:665 Module.require
internal/modules/cjs/loader.js:665:17
- helpers.js:20 require
internal/modules/cjs/helpers.js:20:18
- worker.js:32 Promise
[Admin]/[gatsby]/dist/utils/worker.js:32:35
- debuggability.js:313 Promise._execute
[Admin]/[bluebird]/js/release/debuggability.js:313:9
- promise.js:483 Promise._resolveFromExecutor
[Admin]/[bluebird]/js/release/promise.js:483:18
error UNHANDLED REJECTION
Error: Cannot find module 'core-js/modules/es6.regexp.to-string'
- loader.js:611 Function.Module._resolveFilename
internal/modules/cjs/loader.js:611:15
- loader.js:537 Function.Module._load
internal/modules/cjs/loader.js:537:25
- loader.js:665 Module.require
internal/modules/cjs/loader.js:665:17
- helpers.js:20 require
internal/modules/cjs/helpers.js:20:18
- render-page.js:3 webpackUniversalModuleDefinition
/Users/rylanhazelton/dev/Admin/public/render-page.js:3:170
- render-page.js:10 Object.<anonymous>
/Users/rylanhazelton/dev/Admin/public/render-page.js:10:3
- loader.js:736 Module._compile
internal/modules/cjs/loader.js:736:30
- loader.js:747 Object.Module._extensions..js
internal/modules/cjs/loader.js:747:10
- loader.js:628 Module.load
internal/modules/cjs/loader.js:628:32
- loader.js:568 tryModuleLoad
internal/modules/cjs/loader.js:568:12
- loader.js:560 Function.Module._load
internal/modules/cjs/loader.js:560:3
- loader.js:665 Module.require
internal/modules/cjs/loader.js:665:17
- helpers.js:20 require
internal/modules/cjs/helpers.js:20:18
- worker.js:32 Promise
[Admin]/[gatsby]/dist/utils/worker.js:32:35
- debuggability.js:313 Promise._execute
[Admin]/[bluebird]/js/release/debuggability.js:313:9
- promise.js:483 Promise._resolveFromExecutor
[Admin]/[bluebird]/js/release/promise.js:483:18
ํธ์ง๊ธฐ๋ฅผ ๋ซ๊ณ .cache, public, node_modules ๋ฐ package-lock.json์ ์ญ์ ํ์ญ์์ค. ๊ทธ๋ฐ ๋ค์ npm ์ค์น๋ฅผ ์ํํ์ญ์์ค.
๋๋ ๊ทธ๊ฒ์ด NPM์ ํํค ํ ํจํค์ง ํด์๋๋ผ๊ณ ํ์ ํฉ๋๋ค.
์ ๊ธ ํ์ผ๊ณผ node_modules
๋ฅผ ์ญ์ ํ์ฌ ๋ด ์ฌ์ดํธ์์ ์ข
์์ฑ์ ๋ถ๋ฅ ํ ์์์์ต๋๋ค. ๊ณ ์ฅ๋ ์ฌ์ดํธ ๋ฐ์์๋ ์ฌํ ํ ์ ์์์ต๋๋ค.
package-lock.json
, node_modules
์ (๋ฅผ) ์ญ์ ํ๊ณ yarn
๋ฅผ ์ฌ์ฉํ์ฌ ์ค์น ํ ํ terser-webpack-plugin
cannot call minify of undefined
์ ๋ํ ๋ ๋ค๋ฅธ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์ด๊ฒ์ ๋๋ฅผ ์ํด ๊ทธ๊ฒ์ ๊ณ ์ณค์ต๋๋ค.
Node.js ์ํ๊ณ๊ฐ ์ ๋ง ๊ฐ์ฅ ๋น ๋ฅธ ์๋ณด๋ผ๊ณ ์๊ฐํฉ๋๋ค ;-)
์ต์ ๊ฐ๊ฒฐํ ์ ๋ฐ์ดํธ (ํ ์๊ฐ ์ ์ ์ถ์๋จ)๊ฐ์ด ํ๋ฌ๊ทธ์ธ์ ์ค๋จํฉ๋๋ค.
๋ฐ๋ผ์ ์ด๊ฒ์ ์๋ก์ด ๋ฌธ์ ์ ๋๋ค (์ข ์์ฑ).
๋ ๊ฐ์ง ๋ค๋ฅธ ๋ฌธ์ ์ธ์ง ํ์ธํ ์ ์์ต๋๋ค. ๋ ๊ฐ์ง ๋ฌธ์ ๊ฐ ๋ชจ๋ ๋ฐ์ํฉ๋๋ค. https://github.com/gr2m/octokit-rest-documentation/issues/24
Terser ์ค๋ฅ๋ ๋ค์ ์ค์์ ๋ฐ์ํฉ๋๋ค.
const {
error,
map,
code,
warnings
} = _terser.default.minify({
[file]: input
}, terserOptions);
_terser.default.minify
๋ฅผ _terser.minify
Travis CI ๋น๋์์๋์ด ๋ฌธ์ ๊ฐ ๋ฐ์ํฉ๋๋ค. yarn
์ฌ์ฉํด๋ ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์ต๋๋ค. ์ ์ ํ ์์ ์ด ๋์ฌ ๋๊น์ง ์ฌ์ฉํ ์์๋ ๋น ๋ฅธ ํจ์น๊ฐ ์์ต๋๊น? ๊ฐ์ฌ
Terser ์ค๋ฅ๋ ์ง๊ธ ํด๊ฒฐ๋์ด์ผํฉ๋๋ค.
terser-webpack-plugin์ด ์์ ๋์์ผ๋ฉฐ ์๋ก์ด ๋ฒ์ ์ terser-webpack-plugin๊ณผ ํจ๊ป 2.0.112๋ฅผ ๊ฒ์ํ์ต๋๋ค.
์ด๊ฒ์ด ๊ด๋ จ์ด ์๋์ง ํ์คํ์ง ์์ง๋ง ์ ๋ฐ์ดํธ๋ฅผ ์๋ํด ์ฃผ์๊ฒ ์ต๋๊น?
๊ทธ๋์ @DanielRuf @dlindahl ๋น์ ์ด๋ณด๊ณ ์๋ ๋ฌธ์ ์ ์ต์ํ์ ์ฌํ์ ๋งํฌ ํด ์ฃผ์๊ฒ ์ต๋๊น?
https://github.com/gatsbyjs/gatsby/issues/11198#issuecomment -457905564 ์ฐธ์กฐ
@sidharthachatterjee ํ์ธํ ์ ์์ต๋๋ค. ํน์ [email protected]๋ก ์ ๊ทธ๋ ์ด๋ํ๋ฉด Gitlab CI์์ ๋ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์์ต๋๋ค.
Terser ์ค๋ฅ๋ ์ง๊ธ ํด๊ฒฐ๋์ด์ผํฉ๋๋ค.
ํ์ธ.
์ด๊ฑธ ๋ง๋ฌด๋ฆฌํฉ์๋ค. ์ถ๊ฐ๋ก ๋์์ด ํ์ํ๊ฑฐ๋์ด ๋ฌธ์ ๊ฐ ํด๊ฒฐ ๋ _ ํ์ธ๋์ง ์์ ๊ฒฝ์ฐ _ ์๊ฒฌ์ ๋ณด๋ด์ฃผ์ญ์์ค.
๋ชจ๋ ๊ฐ์ฌํฉ๋๋ค!
์ด ๋ฌธ์ ๊ฐ ์ด๋ฆฐ ์๋ ์ค๋ฅ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
@ gr2m ๋ณต์ ํ ์ ์ ๊ณต ํ ์ ์์ต๋๊น?
์ด์จ๋ ๋ค์ ์ด๊ฒ ์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค!
๋๋ ๋๊ฐ์ ๋ฌธ์ ๊ฐ ์์๋ค.
๋ชจ๋ ๊ตฌ๋ฌธ ๋ถ์ ์คํจ : ์๊ธฐ์น ์์ ํ ํฐ (8:11)
์ด ํ์ผ ์ ํ์ ์ฒ๋ฆฌํ๋ ค๋ฉด ์ ์ ํ ๋ก๋๊ฐ ํ์ํ ์ ์์ต๋๋ค.
์ค ์์ ์ ๋๋ฅผ ์ํด ์ผํ์ต๋๋ค.
.cache / public / node_modules ์ญ์ ๊ฐ ์๋ํ์ง ์์์ต๋๋ค.
npm ์ ๋ฐ์ดํธ๋ฅผ ์คํ ํ ํ ๋ฌธ์ ๊ฐ ์์๋์์ต๋๋ค.
์ฌ๊ธฐ์ ๊ฐ์ ๋ฌธ์ .
"@magicsoup.io/stock": "0.0.11",
"@zauberware/react-scroll-to": "^0.1.1",
"@zauberware/react-svg-assets": "^0.10.2",
"babel-plugin-styled-components": "^1.10.0",
"gatsby": "^2.0.115",
"gatsby-image": "^2.0.29",
"gatsby-plugin-htaccess": "^1.0.8",
"gatsby-plugin-manifest": "^2.0.17",
"gatsby-plugin-offline": "^2.0.22",
"gatsby-plugin-react-helmet": "^3.0.6",
"gatsby-plugin-sharp": "^2.0.20",
"gatsby-plugin-sitemap": "^2.0.5",
"gatsby-plugin-styled-components": "^3.0.5",
"gatsby-plugin-web-font-loader": "^1.0.4",
"gatsby-source-filesystem": "^2.0.20",
"gatsby-transformer-json": "^2.1.8",
"gatsby-transformer-remark": "^2.2.4",
"gatsby-transformer-sharp": "^2.1.13",
"marksy": "^6.1.0",
"prop-types": "^15.6.2",
"react": "^16.7.0",
"react-dom": "^16.7.0",
"react-helmet": "^5.2.0",
"react-i18next": "^10.0.0",
"react-obfuscate": "^3.0.0",
"react-slick": "^0.23.2",
"styled-components": "^4.1.3",
"styled-normalize": "^8.0.6",
"styled-system": "^3.2.1",
src / templates์์ ํ ํ๋ฆฟ์๋ก๋ํ๋ ค๊ณ ํฉ๋๋ค.
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---src-templates-markdown-template-js": function componentSrcTemplatesMarkdownTemplateJs() {
> return import("/Users/simon/workspaces/web/altstadtdomizil/src/templates/markdownTemplate.js"
| /* webpackChunkName: "component---src-templates-markdown-template-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
gatsby-node.js
exports.createPages = ({ actions, graphql }) => {
const { createPage } = actions
const blogPostTemplate = path.resolve(`src/templates/markdownTemplate.js`)
return graphql(`
{
allMarkdownRemark(
sort: { order: DESC, fields: [frontmatter___title] }
limit: 1000
) {
edges {
node {
frontmatter {
path
}
}
}
}
}
`).then(result => {
if (result.errors) {
return Promise.reject(result.errors)
}
result.data.allMarkdownRemark.edges.forEach(({ node }) => {
createPage({
path: node.frontmatter.path,
component: blogPostTemplate,
context: {}, // additional data can be passed via context
})
})
})
}
gatsby-node.js๋ฅผ ์ฃผ์ ์ฒ๋ฆฌํ๋ฉด์ด ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---src-pages-404-js": function componentSrcPages404Js() {
> return import("/Users/simon/workspaces/web/altstadtdomizil/src/pages/404.js"
| /* webpackChunkName: "component---src-pages-404-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
return import (
๋ค๋ฅธ ์๊ฒฌ์ ์ฐธ์กฐํ์ญ์์ค.
2.0.115์์ 2.0.116 ๋๋ 2.0.117๋ก ์ ๊ทธ๋ ์ด๋ํ๋ ๋์ ๋ฐฐ์ง / ์ค๋ # 2947์ ํ์๋ฉ๋๋ค.
๋๋ ์ต๊ทผ์ babel-preset-gatsby
๋ฅผ 0.1.6์์ 0.1.7๋ก ์
๋ฐ์ดํธ ํ ๋ฐฐ์ง / ์ค๋ # 2949๋ฅผ ๋ณํฉํ์ง๋ง, ๋ค์ด ๊ทธ๋ ์ด๋์์ ํดํน์ ์๋ํ์ง๋ง ๋ฌธ์ ๊ฐ ํด๊ฒฐ๋์ง ์์์ต๋๋ค.
๋ฌธ์ ๋ CI์ ํฌ์ฐฉ๋์ด ์ผ๊ด๋๊ฒ ๋ํ๋ฉ๋๋ค. ์ฐ๋ฆฌ CI๋ .cache
๋ณด์กดํ์ง ์์ผ๋ฏ๋ก ๋ฐฐ์ ํ ์ ์์ต๋๋ค.
Error: ./.cache/async-requires.js 8:11
Module parse failed: Unexpected token (8:11)
You may need an appropriate loader to handle this file type.
| exports.components = {
| "component---frontend-components-main-js": function componentFrontendCompo nentsMainJs() {
> return import("/home/circleci/project/frontend/components/main.js"
| /* webpackChunkName: "component---frontend-components-main-js" */
| );
@ ./.cache/production-app.js 18:0-45 21:23-36 26:23-36
์ด๊ฒ์ด ๋ฌธ์ ๋ผ๊ณ ์๊ฐํฉ๋๋ค : webpack / webpack # 8656.
์ถ๊ฐ๋จ : ์ฆ์์ด ์ผ์นํ๊ณ ํ์ด๋ฐ๋ ๋ง์ต๋๋ค.
@paulmelnikow ์ข์ ์บ์น. ์ด๊ฒ์ด ESM์ ์ฌ์ฉํ ํ์๊ฐ์๋ ๊ฒฝ์ฐ CJS ์ฌ์ฉ์ ๊ถ์ฅํ๋ ์ด์ ์ ๋๋ค. ๋ฒ ๋ค๋ฌ์์๋ ์ฌ์ ํ 100 % ์ ๋ขฐํ ์ ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ ์ฌ์ ํ โโ์๋ํฉ๋๋ค.
๊ทธ๋ ๋ค๋ฉด ๋ฃจํธ package.json์ webpack์ ๊ณ ์ ํ๋ฉด ์๋ํฉ๋๊น?
๊ทธ๋ฆฌ๊ณ ์ด๊ฒ์ด JS ์ํ๊ณ์ SemVer๊ฐ ์์ ํ ๋ง๊ฐ์ง ์ด์ ์ด๊ธฐ๋ํฉ๋๋ค. ์ ๊ธ ํ์ผ์ด ๋ฃจํธ ์์ค์์๋ง ์๋ํ๊ธฐ ๋๋ฌธ์ (deep) deps์ ์๋ ์ ๋ฐ์ดํธ๊ฐ ์ํ๋ฉ๋๋ค.
๋ช
ํํ๊ฒ ๋งํ๋ฉด acorn
๋ฐ npm์ด deptree๋ฅผ ํด๊ฒฐํ๋ ๋ฐฉ์์ด ๋ฌธ์ ์ ์์ธ์
๋๋ค.
https://github.com/webpack/webpack/issues/8656#issuecomment -456010969
๋๋ ์ด๊ฒ์ ์ฌํ ํ ์์๋ค (์ฐ๋ฆฌ๊ฐ ์ฌ์ ํ ์ผํ๋ฉด์ ์ค์ ์ฌ์ฉํ๋ ๋ ๋ค๋ฅธ ์ด์ ).
์ ํํ ๋งํ์๋ฉด npm ๋ฌธ์ ์ ๋๋ค.
https://npm.community/t/packages-with-peerdependencies-are-incorrectly-hoisted/4794/4
https://npm.community/t/release-npm-6-8-0-next-0/5058
ํด๊ฒฐ ๋ฐฉ๋ฒ : ์ต์ npm ๋ฆด๋ฆฌ์ค๋ฅผ ์ค์นํ์ญ์์ค.
๊ทธ ํ๊ฐ์ ๋์ํ๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ์ด๊ฒ์ ํด์๋๊ฐ ๋ฐ์ํ๋ ๋ฐฉ์์ ์ฐจ์ด๋ก ์ธํด ์ค์ด ์๋ npm์ผ๋ก ๋ํ๋ ์ ์์ง๋ง, 4.29.3์ ํจํค์ง๊ฐ ^ 4.12.0์ ๋ํ ์ข ์์ฑ์ ์ ์ธํ์ ๋ ์ค์นํ๊ธฐ์ ์๋ฒฝํ๊ฒ ์ฌ๋ฐ๋ฅธ ๋ฒ์ ์ ๋๋ค. ๊ทธ๊ฒ์ด ์บ๋ฟ์ด ์๋ฏธํ๋ ๋ฐ์ ๋๋ค. Gatsby๊ฐ ํน์ ๋ฒ์ ์ ์ ๊ทธ๊ณ ์ถ๋ค๋ฉด ๊ทธ๋ ๊ฒํ๋ ๊ฒ์ ํ์ํ๋ฉฐ,์ด ๊ฒฝ์ฐ npm์ด์ด๋ฅผ ์กด์คํฉ๋๋ค.
Webpack์ ํผ์ด ์ข ์์ฑ์ด ์๋๋ผ Gatsby์ ์ข ์์ฑ์ ๋๋ค.
๋ฌธ์ ๋ npm (Yarn์์ ๋ค๋ฆ)์ ํธ์ด ์คํ
์ด๋ฉฐ ์ด๋ก ์ธํด acorn
์ ๋๋ก๋ก๋ ํ ์ ์๋ค๋ ๊ฒ์
๋๋ค. Tobias ์ปค๋ฎค๋ํฐ ๊ฒ์๋ฌผ ๋ฐ ๋งํฌ ๋ ๋๊ธ์ ์ฐธ์กฐํ์ญ์์ค.
๋น์ ์ด ๋ ์ ์ค๋ช ํด์ฃผ๊ธธ ๋ฐ๋์. ๋๋ ๊ทธ ์ค๋ ๋๋ฅผ ํ์ด ๋ณด์์ง๋ง ์ฌ๊ธฐ์ ์ด๋ป๊ฒ ์ ์ฉ๋๋์ง ๋ณด์ง ๋ชปํ์ต๋๋ค.
Webpack์์ ๋ฒ๊ทธ์ ์์ธ์ด ๋ฌด์์ธ์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. ๊ทธ๋ฌ๋ Gatsby๊ฐ 4.29.3์ ์ฌ์ฉํ์ง ์์์ผํ๋ค๋ ๋ฐ ๋์ํ๋ฉด ์บ๋ฟ ์ข ์์ฑ์ ๋ณ๊ฒฝํด์ผํฉ๋๋ค.
์ด๋ yarn๊ณผ ํจ๊ป ์๋ํ๋ฉฐ ํน์ ์ข ์์ฑ ๋ฐ deptree ๊ณ์ฐ๊ณผ ํจ๊ป npm์ ๋ฌธ์ ์ ๋๋ค. Tobias์ PR์ ์ฐธ์กฐํ์ญ์์ค.
Aiiiee gotcha. ์นํฉ 4.29๊ฐ ์ ๋๋ก ์๋ํ์ง ์๋ ์์ธ์ npm์ ํผ์ด ์ข ์์ฑ ๋ฒ๊ทธ์ ๋๋ค.
์ฐ๋ฆฌ๊ฐ ๋ฐฉ์ง ํ ์์๋ ๊ฒ์ ์นํฉ 4.29์ ์ค์น์ ๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ต์ข ์ฌ์ฉ์๊ฐ ์นํฉ ๋ฒ์ ์ ์ ๊ทธ๋ ์ฌ์ด ๋ฐฉ๋ฒ์ด ์๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค. npm์์ด๋ฅผ ์ํํ๋ ๋ฐฉ๋ฒ์ ์ ๊ณตํ์ง ์์ผ๋ฏ๋ก ์ฌ์ฉ์๋ ํ์ฌ ๋๊ตฌ ์ธ npm-force-resolutions ์ ๊ฐ์ ๊ฒ์ ์ฌ์ฉํด์ผํฉ๋๋ค.
npm / cli # 152; ๋น ๋ฅธ ํด๊ฒฐ์ ๊ธฐ๋ํ ์์๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ด์ 2.0.118์ด ๋ฐ์ฐฝ๊ณ ๋ฅผ ์ ๊ณตํ๋ฏ๋ก npm ์ฌ์ฉ์๋ ๊ด์ฐฎ์ ๊ฒ์ด๋ฉฐ ๋ถ๋ช ํ ์นํฉ 4.29.x๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
์์ฌ ์ฌ์ฉ์๊ฐ resolutions
๋ฅผ ์ฌ์ฉํ์ฌ Gatsby๊ฐ ์ํ ๊ฒฝ์ฐ ๋ฒ์๋ฅผ ๋ฒ์ด๋ ์ต์ ๋ฒ์ ์ ์ฌ์ฉํ๋๋ก ํ ์ ์๋ค๋ ๊ฒ์ด ๋ง์ต๋๊น?
@paulmelnikow ๋ง์ต๋๋ค-ํ์ง๋ง ๊ผญ ํ์ํ ๊ฒ์ ์๋๋ฉฐ ๊ทธ๋ ๊ฒํ๋ ๋ฐ ํ์ํ ํน๋ณํ ์ด์ ์ด ์๋์ง ์ ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
๊ฐ๋ฅํ ํ ๋นจ๋ฆฌ ๊ณ ์ ๋ ์ข
์์ฑ์ ์
๋ฐ์ดํธ ํ ๊ฒ์ด๋ฏ๋ก (์ง๊ธ npm ๋ฌธ์ ๋ฅผ ๋ฐ๋ฆ) ํนํ npm
์ฌ์ฉ์์๊ฒ๋ ์ผ์์ ์ผ ๊ฒ์
๋๋ค.
์์ ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค!
_ ์ง๊ธ _ ์ด๊ฑฐ ๋๋ผ ์์์ ๊ฒ ๊ฐ์์ :)
2.0.118 ๋ฆด๋ฆฌ์ค๋ก ์์ ๋์์ต๋๋ค!
๋ฐ๋ผ๊ฐ๋ ๊ฒ์ด ๋๋์ต๋๋ค. ๋๋ผ์ด ์์ ์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค!
๋ชจ๋ ์๋
! ๋๋ ๋ํฌ๋ค์ด npm install gatsby@webpack-acorn
์คํ์ ์ค ์ ์๋์ง ๊ถ๊ธํฉ๋๋ค. ์นํฉ์ ์ต์ ๋ฒ์ ์ผ๋ก ์
๊ทธ๋ ์ด๋ํ๊ณ ์ถ์ง๋ง ์ด๊ฒ์ด ์ฌ์ ํ ๋ฌธ์ ์ธ์ง ํ์คํ์ง ์์ต๋๋ค. ๋๋ ๊ทธ๊ฒ์ ์ฌํ ํ ์ ์์์ง๋ง ์ฐ๋ฆฌ๋ ๋ฏธ์ํ๊ธฐ๋ณด๋ค๋ ์์ ํ๊ณ ์ถ์ต๋๋ค.
์๋ ํ์ธ์ @wardpeet! ๋ฌธ์ ํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค.
์ฌ๊ธฐ์ ๋ธ๋์น๋ฅผ ๋ง๋ค์์ต๋๋ค : badges / shields # 3572
์ฌ์ ํ ๋ฌธ์ ์ธ ๊ฒ ๊ฐ์ต๋๋ค : https://circleci.com/gh/badges/shields/57401
๋ก์ปฌ๋ก ๋ณต์ ํ๋ ๋จ๊ณ๋ ํด๋น ๋ถ๊ธฐ๋ฅผ ๋ณต์ ํ๊ณ npm ci
๋ค์์ npm run build
์
๋๋ค. ์ํ์๋ฉด ์ธ์ ๋ ์ง ๊ทธ๋ ๊ฒ ํ์๊ฑฐ๋ ์ ์๊ฒ ping์ ๋ณด๋ด์๋ฉด PR ๋ธ๋์น๋ฅผ ์
๋ฐ์ดํธ ํ ์ ์์ต๋๋ค.
@paulmelnikow ์ ๋ง ๊ฐ์ฌํฉ๋๋ค! ๋ํ ์ฌ์ฉ์ค์ธ ๋ ธ๋ ๋ฐ npm ๋ฒ์ ์ ์๋ ค ์ฃผ์๋ฉด ์ ์๊ฒ ๋ง๋ ๊ฒฝ์ฐ๋ฅผ ๋๋นํ์ฌ ์ค์ ์ผ๋ก ์คํํ ์ ์์ต๋๋ค.
์ด๊ฒ์ ๋ด๊ฐ ๋ก์ปฌ์์ ์ป์ ๊ฒ์ ๋๋ค.
~/c/shields (bump-webpack-rc|โ) $ node --version
v10.13.0
~/c/shields (bump-webpack-rc|โ) $ npm --version
6.9.0
CI์์๋ Node 8์์๋ ๋ฐ์ํฉ๋๋ค (์ ํํ npm ๋ฒ์ ์ ํ์คํ์ง ์์).
๋ฌธ์ ๋ ๋ ํ๊ฒฝ ๋ชจ๋์์ ์ฌํ ๊ฐ๋ฅํฉ๋๋ค.
์กฐ์ฌํด ์ฃผ์ ์ ๊ฐ์ฌํฉ๋๋ค!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ํด๊ฒฐ ๋ฐฉ๋ฒ์ npm ์ ๊ธ ํ์ผ์ ๊ฐ์ ธ์จ ํ ์๋ํ๋ ๊ฒ์ฒ๋ผ ๋ณด์ด๋ npm ๋์ Yarn์ ์ฌ์ฉํ์ฌ ์ข ์์ฑ์ ์ค์นํ๋ ๊ฒ์ ๋๋ค.