Use vtk.js / glsl files in angular cli app

I found the solution here. You don't have to eject since Angular 6 has disabled ejection. Just follow the article and the extra-webpack.config.js content is as follows:

  module.exports = {
  module: {
    rules: [
      {
        test: /\.glsl$/i,
        include: /node_modules(\/|\\)vtk\.js(\/|\\)/,
        loader: 'shader-loader',
      },
      {
        test: /\.js$/,
        include: /node_modules(\/|\\)vtk\.js(\/|\\)/,
        loader: 'babel-loader?presets[]=env',
      },
      {
        test: /\.worker\.js$/,
        include: /node_modules(\/|\\)vtk\.js(\/|\\)/,
        use: [
          {
            loader: 'worker-loader',
            options: { inline: true, fallback: false },
          },
        ],
      },
    ],
  },
};

of course, you have to install the dependency vtk.js and kw-web-suit. Then it should be compiled successfully. if you meet the error which says "global is not defined" in browser's developer mode, then add (window as any).global = window; to Angular's polyfills.ts. It works for me on Angular 6 with the latest vtk.js.