Giter VIP home page Giter VIP logo

Comments (21)

catamphetamine avatar catamphetamine commented on August 25, 2024

You can post your webpack-stats.json and your configuration

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

I don't see webpack-stats.json generated
My configuration is

var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
// see this link for more info on what all of this means
// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
module.exports = {
  // when adding "js" extension to asset types 
  // and then enabling debug mode, it may cause a weird error:
  //
  // [0] npm run start-prod exited with code 1
  // Sending SIGTERM to other processes..
  //
  // debug: true, 
  // alias: webpack_configuration.resolve.alias, 
  assets: {
    images: {
      extensions: [
        'jpeg',
        'jpg',
        'png',
        'gif'
      ],
      parser: WebpackIsomorphicToolsPlugin.url_loader_parser
    },
    fonts: {
      extensions: [
        'woff',
        'woff2',
        'ttf',
        'eot'
      ],
      parser: WebpackIsomorphicToolsPlugin.url_loader_parser
    },
    svg: {
      extension: 'svg',
      parser: WebpackIsomorphicToolsPlugin.url_loader_parser
    },
    style_modules: {
      extensions: ['less','scss'],
      filter: function(module, regex, options, log) {
        if (options.development) {
          // in development mode there's webpack "style-loader",
          // so the module.name is not equal to module.name
          return WebpackIsomorphicToolsPlugin.style_loader_filter(module, regex, options, log);
        } else {
          // in production mode there's no webpack "style-loader",
          // so the module.name will be equal to the asset path
          return regex.test(module.name);
        }
      },
      path: function(module, options, log) {
        if (options.development) {
          // in development mode there's webpack "style-loader",
          // so the module.name is not equal to module.name
          return WebpackIsomorphicToolsPlugin.style_loader_path_extractor(module, options, log);
        } else {
          // in production mode there's no webpack "style-loader",
          // so the module.name will be equal to the asset path
          return module.name;
        }
      },
      parser: function(module, options, log) {
        if (options.development) {
          return WebpackIsomorphicToolsPlugin.css_modules_loader_parser(module, options, log);
        } else {
          // in production mode there's Extract Text Loader which extracts CSS text away
          return module.source;
        }
      }
    }
  }
}

The same as in https://github.com/erikras/react-redux-universal-hot-example

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

enable // debug: true, in your config and webpack stats will appear

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

Pretty big 120000 lines - uploading as gist...

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

here it is https://gist.github.com/lapanoid/415260c1b5ff6b8fae41

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

You have two modules:

    {
      "id": 915,
      "identifier": "/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
      "name": "../topico-content/~/css-loader!../topico-content/~/sass-loader!../topico-content/styles/bootstrap/bootstrap-build.scss",
      "index": 915,
      "index2": 913,
      "size": 131384,
      "cacheable": true,
      "built": true,
      "optional": false,
      "prefetched": false,
      "chunks": [
        0
      ],
      "assets": [],
      "issuer": "/Users/sergeylapin/repos/topico/topico-content/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
      "failed": false,
      "errors": 0,
      "warnings": 0,
      "reasons": [
        {
          "moduleId": 914,
          "moduleIdentifier": "/Users/sergeylapin/repos/topico/topico-content/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
          "module": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "moduleName": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "type": "cjs require",
          "userRequest": "!!./../../node_modules/css-loader/index.js!./../../node_modules/sass-loader/index.js!./bootstrap-build.scss",
          "loc": "4:14-132"
        },
        {
          "moduleId": 914,
          "moduleIdentifier": "/Users/sergeylapin/repos/topico/topico-content/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
          "module": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "moduleName": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "type": "module.hot.accept",
          "userRequest": "!!./../../node_modules/css-loader/index.js!./../../node_modules/sass-loader/index.js!./bootstrap-build.scss",
          "loc": "13:2-17:4"
        },
        {
          "moduleId": 914,
          "moduleIdentifier": "/Users/sergeylapin/repos/topico/topico-content/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
          "module": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "moduleName": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "type": "cjs require",
          "userRequest": "!!./../../node_modules/css-loader/index.js!./../../node_modules/sass-loader/index.js!./bootstrap-build.scss",
          "loc": "14:20-138"
        }
      ],
      "source": "exports = module.exports = require(\"./../../node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \"@charset \\\"UTF-8\\\";\\n/*!\\n * Bootstrap SASS\\n *\\n * Copyright 2013 Twitter, Inc ..."
    },
    {
      "id": 2277,
      "identifier": "/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
      "name": "./~/css-loader!./~/sass-loader!../topico-content/styles/bootstrap/bootstrap-build.scss",
      "index": 2277,
      "index2": 2273,
      "size": 131400,
      "cacheable": true,
      "built": true,
      "optional": false,
      "prefetched": false,
      "chunks": [
        0
      ],
      "assets": [],
      "issuer": "/Users/sergeylapin/repos/topico/topic-portal/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
      "failed": false,
      "errors": 0,
      "warnings": 0,
      "reasons": [
        {
          "moduleId": 2276,
          "moduleIdentifier": "/Users/sergeylapin/repos/topico/topic-portal/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
          "module": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "moduleName": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "type": "cjs require",
          "userRequest": "!!./../../../topic-portal/node_modules/css-loader/index.js!./../../../topic-portal/node_modules/sass-loader/index.js!./bootstrap-build.scss",
          "loc": "4:14-164"
        },
        {
          "moduleId": 2276,
          "moduleIdentifier": "/Users/sergeylapin/repos/topico/topic-portal/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
          "module": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "moduleName": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "type": "module.hot.accept",
          "userRequest": "!!./../../../topic-portal/node_modules/css-loader/index.js!./../../../topic-portal/node_modules/sass-loader/index.js!./bootstrap-build.scss",
          "loc": "13:2-17:4"
        },
        {
          "moduleId": 2276,
          "moduleIdentifier": "/Users/sergeylapin/repos/topico/topic-portal/node_modules/style-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
          "module": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "moduleName": "../topico-content/styles/bootstrap/bootstrap-build.scss",
          "type": "cjs require",
          "userRequest": "!!./../../../topic-portal/node_modules/css-loader/index.js!./../../../topic-portal/node_modules/sass-loader/index.js!./bootstrap-build.scss",
          "loc": "14:20-170"
        }
      ],
      "source": "exports = module.exports = require(\"./../../../topic-portal/node_modules/css-loader/lib/css-base.js\")();\n// imports\n\n\n// module\nexports.push([module.id, \"@charset \\\"UTF-8\\\";\\n/*!\\n * Bootstrap SASS\\n *\\n * Copyright 2013 Twitter, Inc\\ ..."
    },

And both their names are parsed into ../topico-content/styles/bootstrap/bootstrap-build.scss.

I don't know why the ../topico-content/styles/bootstrap/bootstrap-build.scss require() path is the same in both names.
Maybe it's somehow connected to npm link command.

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

I am not quite getting, why it is a unresolved conflict? I can not require same module twice with webpack-isomorphic-tools?

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

It is not the same module, it's two different modules.
But for some reason they have the same require() path.
I don't know why.

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

Still not getting=( How they considered different if they resolved in same path?

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

they have different filesystem path and therefore they are different.
they are different webpack modules and therefore they are different.

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

I don't have duplicate of this file anywhere, so file and the path is the same if you delete loader prefixes from identifier - which I suppose should be unique.
So I assume, conflict arises because file is loaded by different loaders

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024
    {
      "id": 915,
      "identifier": "/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
      "name": "../topico-content/~/css-loader!../topico-content/~/sass-loader!../topico-content/styles/bootstrap/bootstrap-build.scss",
    {
      "id": 2277,
      "identifier": "/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/styles/bootstrap/bootstrap-build.scss",
      "name": "./~/css-loader!./~/sass-loader!../topico-content/styles/bootstrap/bootstrap-build.scss",

The paths are different

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

We use different terms I guess.I mean path to file, without loader prefixes.
if you delete
/Users/sergeylapin/repos/topico/topico-content/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topico-content/node_modules/sass-loader/index.js!
and
/Users/sergeylapin/repos/topico/topic-portal/node_modules/css-loader/index.js!/Users/sergeylapin/repos/topico/topic-portal/node_modules/sass-loader/index.js!
the rest in both will be file path and it be exactly the same.
While linking, loaders are used from linked project which produce this conflict.

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

Ah, okay, my statement was incorrent, the paths are the same.
The loaders are different.
Why are the loaders different - I don't know.

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

I don't know why it uses ../topico-content/~/css-loader loader instead of the local one (./~/css-loader).
Maybe it's Webpack npm link issue.
Apply this workaround:
https://webpack.github.io/docs/troubleshooting.html

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024
module.exports = {
  resolve: { fallback: path.join(__dirname, "node_modules") },
  resolveLoader: { fallback: path.join(__dirname, "node_modules") }
};

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

I use this already..

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

When it require()s topico-content module maybe it goes into that folder and that's why it may be using the wrong loaders from that folder.
Maybe it's the issue.

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

correct answer is

module.exports = {
  resolve: { root: path.join(__dirname, "node_modules") },
  resolveLoader: { root: path.join(__dirname, "node_modules") }
};

fallback applied only if match is failed, so in case of linking it does not really help

from webpack-isomorphic-tools.

sergey-lapin avatar sergey-lapin commented on August 25, 2024

Thanks for the help!

from webpack-isomorphic-tools.

catamphetamine avatar catamphetamine commented on August 25, 2024

FYI
I'm posting this in every issue and PR to notify whoever may be interested:
today I've released an alternative helper library called universal-webpack.
It takes a different approach than webpack-ismorphic-tools and instead of hacking Node.js require() calls it just compiles all code with target: 'node' webpack configuration option.
As a result, all Webpack plugins and features are supported.
If you think you might need that here's an example project:
https://github.com/halt-hammerzeit/webpack-react-redux-isomorphic-render-example

from webpack-isomorphic-tools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.