PrismJS / PrismJS/prism

Simplify import with typescript, webpack, angular

Open
#3,666 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13k
Forks
1.4k
Avg merge
15h 36m
Merged PRs (30d)
3

Description

I am using the library in a project with Angular and I have not been able to import the library correctly

I understand that the correct way would be to import the autoloader, because the components index.js doesn't work

`import 'prismjs/plugins/autoloader/prism-autoloader';
But the autolader generates urls incorrectly

The only way that has worked for me is to include language by language, but some languages have dependencies and give errors on their inclusion, there are more than 500 files in the language components folder, which makes it very difficult to deal with them one by one.

You could use some webpack plugin to load the components folder, but you would still have to resolve the dpeendency issues.

It should be something easy to include the library, instead there are many unresolved issues from people who couldn't include it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by examining prismjs/plugins/autoloader/prism-autoloader and the language components folder to understand how URLs and dependencies are resolved. Define a webpack-compatible import path that works in Angular without adding languages one by one, then verify that the library can load components without dependency errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript, typescript, webpack
Domain
build-system, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.