How to link a single file to webpack, without module runtime?

I have a project with actions.js and typescript that compiled it in two fragments: app.bundle.js(application code), vendor.bundle.js(libraries) with the following webpack configuration:

{
  entry: {
    app: ['/src/app.tsx'],
    vendor: ['react', 'react-dom', <...>]
  },
  output: {
    filename: '[name].bundle.js',
    path: path.resolve('./build')
  },
  ...
  plugins: [
    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js', Infinity),
    ...
  ]
}

I need to link the file sw.tsseparately, without webpack runtime. How can i do this? Adding as another common fragment leads to an error, moving sw.ts to the entry point makes it using a function webpackJsonp, but I could not just trinspile from ts to js.

+4
source share

Source: https://habr.com/ru/post/1651054/


All Articles