subhendukundu / worker-auth-providers

worker-auth-providers is an open-source providers to make authentication easy with workers. Very lightweight script which doesn't need a lot of dependencies. Plug it with any framework or template of workers.
https://authc1.com
293 stars 31 forks source link

Webpack 5 breaking changes #14

Closed Mecanik closed 1 year ago

Mecanik commented 2 years ago

I`m using webpack and unable to compile this.

Errors are:

ERROR in ./node_modules/worker-auth-providers/src/index.js 1:0-45
Module not found: Error: Can't resolve './providers/github' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/github' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 2:0-45
Module not found: Error: Can't resolve './providers/google' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/google' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 3:0-46
Module not found: Error: Can't resolve './providers/aws-sns' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/aws-sns' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 4:0-45
Module not found: Error: Can't resolve './providers/twilio' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/twilio' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 5:0-49
Module not found: Error: Can't resolve './providers/facebook' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/facebook' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 6:0-47
Module not found: Error: Can't resolve './providers/discord' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/discord' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 7:0-47
Module not found: Error: Can't resolve './providers/spotify' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/spotify' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 8:0-60
Module not found: Error: Can't resolve './providers/sendgrid-email' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/sendgrid-email' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

ERROR in ./node_modules/worker-auth-providers/src/index.js 9:0-58
Module not found: Error: Can't resolve './providers/mailgun-email' in '/.../node_modules/worker-auth-providers/src'
Did you mean 'index.js'?
BREAKING CHANGE: The request './providers/mailgun-email' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
 @ ./src/worker.ts 10:32-64
 @ ./src/index.ts 3:17-36

webpack.config.js

const path = require('path')

module.exports = {
  entry: './src/index.ts',
  output: {
    filename: 'worker.js',
    path: path.join(__dirname, 'dist'),
  },
  devtool: 'cheap-module-source-map',
  mode: 'production',
  resolve: {
    extensions: ['.ts', '.tsx', '.js'],
  },
  module: {
    rules: [
      {
        test: /\.tsx?$/,
        loader: 'ts-loader',
        options: {
          // transpileOnly is useful to skip typescript checks occasionally:
          // transpileOnly: true,
        },
      },
    ],
  },
}

tsconfig.json

{
  "compilerOptions": {
    "outDir": "./dist",
    "module": "commonjs",
    "target": "esnext",
    "lib": ["esnext"],
    "alwaysStrict": true,
    "strict": true,
    "preserveConstEnums": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "esModuleInterop": true,
    "types": [
      "@cloudflare/workers-types",
      "@types/service-worker-mock",
      "@types/node"
    ],
    "noImplicitAny": false,
    "useUnknownInCatchVariables": false,
  },
  "include": ["src"],
  "exclude": ["node_modules", "dist", "test"]
}

package.json

"webpack": "^5.38.1",
"webpack-cli": "^4.7.0"

Tries messing with webpack rules but no success.

Mecanik commented 2 years ago

Any idea how to fix this?

subhendukundu commented 1 year ago

Is this still an issue? If so can you please provide a repo to reproduce this issue.