Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack Error: Default condition should be last one #4061

Closed
UniBrowse opened this issue Jul 14, 2022 · 2 comments
Closed

Webpack Error: Default condition should be last one #4061

UniBrowse opened this issue Jul 14, 2022 · 2 comments

Comments

@UniBrowse
Copy link

It seems like a really semantic issue but a module error is thrown if not followed:

According to the Webpack Docs, the "default" key should be the last item in an exports field. See the details below to replicate and correct the error.

package.json

{
  "dependencies": {
    "framework7": "^7.0.6"
  },
  "devDependencies": {
    "webpack": "^5.73.0",
    "webpack-cli": "^4.10.0"
  }
}

webpack.config.js

const path = require('path');

module.exports = {
  mode: 'production',
  entry: './src/index.js',
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  }
};

src/index.js

import Framework7 from 'framework7/bundle';
var app = new Framework7({/*...*/});

console output

C:\framework7>npx webpack --config webpack.config.js
assets by status 259 bytes [cached] 1 asset
./src/index.js 81 bytes [built] [code generated]

ERROR in ./src/index.js 1:0-43
Module not found: Error: Default condition should be last one

webpack 5.73.0 compiled with 1 error in 299 ms

To correct this error the "default" keys should be moved to below the "types" keys in package.json:
Screenshot 2022-07-15 014101

@radykal
Copy link

radykal commented Jul 14, 2022

I got the same issue when I updated today to the latest version. Reverting back to previous version and the error was gone.

@yoyo930021
Copy link
Contributor

Why don't change the order?
The type is broken again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants