Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Doesn't work with webpack 5 #21

@ajotka

Description

@ajotka

Hi,

I am working on upgrade your different package - svg sprite loader.
And I found out that webpack-toolkit is also not compatible with Webpack 5.

I have solution (I hope), but I don't know how do you want to keep/provide backward compatibility.

Solution:

lib/createCachedInputFileSystem.js

var fs = require('fs');
var CachedInputFileSystem = require('enhanced-resolve/lib/CachedInputFileSystem');

module.exports = function createCachedInputFileSystem() {
  return new CachedInputFileSystem(fs, 60000);
};

lib/addEntry.js

var EntryPlugin = require('webpack/lib/EntryPlugin');

/**
 * Add single entry programmatically. Loaders syntax allowed in entryPath param.
 * @param {Compiler} compiler
 * @param {String} entry Entry location. Relative to compiler context path. Can contains loaders requests
 * @param {String} [name='main'] Entry name
 * @param {String} [context]
 */
module.exports = function addEntry(compiler, entry, name, context) {
  var ctx = context || compiler.options.context;
  var n = name || 'main';

  var dep = new EntryPlugin(ctx, entry, n);

  compiler.apply(dep);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions