Comments (21)
You can post your webpack-stats.json
and your configuration
from webpack-isomorphic-tools.
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.
enable // debug: true,
in your config and webpack stats will appear
from webpack-isomorphic-tools.
Pretty big 120000 lines - uploading as gist...
from webpack-isomorphic-tools.
here it is https://gist.github.com/lapanoid/415260c1b5ff6b8fae41
from webpack-isomorphic-tools.
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.
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.
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.
Still not getting=( How they considered different if they resolved in same path?
from webpack-isomorphic-tools.
they have different filesystem path and therefore they are different.
they are different webpack modules and therefore they are different.
from webpack-isomorphic-tools.
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.
{
"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.
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.
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.
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.
module.exports = {
resolve: { fallback: path.join(__dirname, "node_modules") },
resolveLoader: { fallback: path.join(__dirname, "node_modules") }
};
from webpack-isomorphic-tools.
I use this already..
from webpack-isomorphic-tools.
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.
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.
Thanks for the help!
from webpack-isomorphic-tools.
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)
- Seems like my webpack.config.js file is getting ignored HOT 1
- Error while wepback build HOT 2
- Is it possible to have _style property in production using ExtractTextPlugin loader HOT 2
- webpack_asset_path is not defined HOT 3
- Keep getting errors module not defined and exports not defined HOT 9
- Ability to ignore warnings / errors HOT 6
- Ability to specify publicPath at runtime for server-side? HOT 1
- Inside CSS, background-url is packaged into absolute paths HOT 1
- Support for compression webpack plugin (js.gz) HOT 1
- Resolving webpack custom module paths HOT 1
- SyntaxError: Unexpected token < (skipping require call, fallback to original loader) HOT 5
- webpack-isomorphic-tools/plugin ReferenceError: window is not defined HOT 11
- Depreciation for webpack 4x HOT 2
- Clarification in README HOT 2
- mini-css-extract-plugin HOT 1
- anyway to define __webpack_public_path__ or cdn? HOT 15
- Webpack resolve extensions not working with SSR
- Babel 7 is not supported HOT 4
- (/config/webpack-assets.json not found) HOT 1
- Unexpected token less file HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webpack-isomorphic-tools.