PSON icon indicating copy to clipboard operation
PSON copied to clipboard

Webpack: Critical dependency: the request of a dependency is an expression

Open ivansglazunov opened this issue 7 years ago • 2 comments

pson/index.js

May be problem here.

var path = require("path"),
    PSON = require(path.join(__dirname, "dist", "PSON.js"));

webpack:

17:11-59 Critical dependency: the request of a dependency is an expression
 @ ./node_modules/pson/index.js

Does not allow to compile projects with webpack / browserify because of the calculated dependency. On client: Uncaught Error: Cannot find module "."

How to deal with this?

Need example repo?

ivansglazunov avatar Feb 09 '18 07:02 ivansglazunov

Should probably be changed to a relative path then. Feels like this repo was created before webpack became a thing :)

dcodeIO avatar Feb 09 '18 10:02 dcodeIO

In case anyone else ends up here, this simple tweak to webpack.config.js solved the problem for me:

  resolve: {
    alias: {
      pson: 'pson/dist/PSON.js',
    },
  },

puck7744 avatar Apr 10 '18 10:04 puck7744