question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

webpack integration

See original GitHub issue

Hi, I am trying to use the library in my react component and having trouble to integrate it with webpack. The bottleneck is the integration of minified codec and webworker scripts.

I modified the dicom file example but the loadImage method didn’t work, so I turned off the webworkers.

Then I realized that the codec OpenJPEG wasn’t loading and resulted in this error

Imports in my react component:

import * as cornerstone from 'cornerstone-core';
import * as cornerstoneTools from 'cornerstone-tools';
import * as cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
cornerstoneWADOImageLoader.external.cornerstone = cornerstone;
import 'OpenJPEG';

Cornerstone’s OpenJPEG github says the codec should be loaded from the js file as a global object.

I tried to bundle it with webpack, as an external:

externals: {
    OpenJPEG: {
      root: [path.join(VENDOR_ROOT, 'openJPEG-FixedMemory'), 'OpenJPEG'],
     },
  },

but it didn’t work. Can anyone help?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

5reactions
AdrianLskcommented, Jul 23, 2018

@hanhanhan thanks for sharing the codesandboxes!

I managed to make the web-worker React example work by using a piece of code from here

Here is a working Codesandbox

1reaction
hanhanhancommented, Jul 23, 2018

@AdrianLsk thanks for figuring it out and introducing me to Blob and importScripts! Time for me to learn more about webworkers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Integrations - webpack
This guide provides a high-level overview of how webpack can be integrated into some of the more popular task runners. NPM Scripts. Often...
Read more >
Using with webpack - Jest
Jest can be used in projects that use webpack to manage assets, ... over other tools because it integrates directly with your application...
Read more >
Integration with Webpack - Flexmonster
Integration with Webpack · Step 1. Create a new project based on the sample from GitHub · Step 2. Install npm packages ·...
Read more >
Webpack Integration - CKEditor 4 Documentation
# Basic Webpack Integration · mkdir ckeditor4-webpack cd ckeditor4-webpack npm init -y · npm install --save-dev ckeditor4 webpack webpack-cli · 'use strict'; const ......
Read more >
@sanity/webpack-integration - npm
Start using @sanity/webpack-integration in your project by running `npm i @sanity/webpack-integration`. There are 4 other projects in the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found