Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix syntax highlighting #1142

Merged
merged 2 commits into from
Nov 1, 2021
Merged

Conversation

sebdesign
Copy link
Contributor

This PR fixes the syntax highlighting issues on the queries and the exceptions.

The syntax highlighting on the SQL code wasn't working at all:

Before

queries-before

After

queries-after

There was no syntax highlighting on the exception code preview:

Before

exception-before

After

exception-after

I've updated highlight.js from 10.x to 11.x and added some css classes.

Also, I've reduced the bundle size by updating an outdated webpack configuration.
The webpack.IgnorePlugin has changed its syntax since it was added in 2018.

So now the bundle is reduced from 1128kb to 894kb!

See: https://webpack.js.org/plugins/ignore-plugin/#example-of-ignoring-moment-locales

I will also submit a PR in Horizon which uses the same configuration for webpack.IgnorePlugin.

@taylorotwell taylorotwell merged commit 34d8860 into laravel:4.x Nov 1, 2021
@driesvints
Copy link
Member

driesvints commented Nov 2, 2021

@sebdesign did you test this? I can't compile our assets anymore when I run npm run prod:

[webpack-cli] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './package.json' is not defined by "exports" in /Users/driesvints/Sites/laravel/telescope/node_modules/postcss/package.json
    at new NodeError (node:internal/errors:371:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:416:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:669:3)
    at resolveExports (node:internal/modules/cjs/loader:482:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (/Users/driesvints/Sites/laravel/telescope/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.check (/Users/driesvints/Sites/laravel/telescope/node_modules/laravel-mix/src/components/CssWebpackConfig.js:15:38) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

@sebdesign
Copy link
Contributor Author

Yes I did compile it and tested it against a laravel app locally. I will make a clean installation right now to see if I can reproduce this.

@sebdesign
Copy link
Contributor Author

@driesvints I assume you did run npm install before npm run prod?

I made a clean installation and I works (Ubuntu 18.04, node 14.18.1, npm 8.1.2).

@driesvints
Copy link
Member

I did. I'm on macOS Monterey, Node v17.0.1, NPM 8.1.0.

If we're not able to figure this out we'll need to revert this so we're unblocked for now.

@sebdesign
Copy link
Contributor Author

Could you try deleting the node_modules directory and then installing it again? Does npm run dev/watch work?

@sebdesign
Copy link
Contributor Author

I could rollback highlight.js 11.x -> 10.x since, it's the only dependency that changed.

@driesvints
Copy link
Member

@sebdesign deleting node modules didn't help. All three dev/watch/prod failed.

@sebdesign
Copy link
Contributor Author

Ok, I'll undo the changes on package.json and package-lock.json. The rest of the changes can stay. Give me a few minutes.

@sebdesign
Copy link
Contributor Author

@driesvints Running npm update laravel-mix vue-loader seems to solve the issue.
I can submit a PR with the updated package-lock.json if you want.

@driesvints
Copy link
Member

ah good find. I'll do it later this week, all good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants