Comments (8)
found solution, adding fullySpecified to false
/* config-overrides.js */
const webpack = require('webpack')
module.exports = function override(config) {
const fallback = config.resolve.fallback || {}
Object.assign(fallback, {
util: require.resolve('util/'),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer'),
assert: require.resolve('assert'),
http: require.resolve('stream-http'),
https: require.resolve('https-browserify'),
os: require.resolve('os-browserify'),
url: require.resolve('url'),
})
config.plugins.push(
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser',
}),
)
config.module.rules = [
...config.module.rules,
{
test: /\.m?js/,
resolve: {
fullySpecified: false,
},
},
]
config.resolve.fallback = fallback
config.ignoreWarnings = [/Failed to parse source map/]
return config
}
from invariant-packages.
I avoided the problem by replacing process/browser
with process: 'process/browser.js'
from invariant-packages.
same issue
from invariant-packages.
@luckyrobot Thanks. This appears to work but it seems like such a monkey patch for this library.
from invariant-packages.
@disarticulate What version of ts-invariant
are you using?
It seems like webpack is injecting an import for process/browser
that does not exist in the ts-invariant
code.
from invariant-packages.
looks like @apollo-client @ 3.6.2 installs ts-variant @ 0.10.2
from invariant-packages.
found solution, adding fullySpecified to false
/* config-overrides.js */ const webpack = require('webpack') module.exports = function override(config) { const fallback = config.resolve.fallback || {} Object.assign(fallback, { util: require.resolve('util/'), crypto: require.resolve('crypto-browserify'), stream: require.resolve('stream-browserify'), buffer: require.resolve('buffer'), assert: require.resolve('assert'), http: require.resolve('stream-http'), https: require.resolve('https-browserify'), os: require.resolve('os-browserify'), url: require.resolve('url'), }) config.plugins.push( new webpack.ProvidePlugin({ Buffer: ['buffer', 'Buffer'], process: 'process/browser', }), ) config.module.rules = [ ...config.module.rules, { test: /\.m?js/, resolve: { fullySpecified: false, }, }, ] config.resolve.fallback = fallback config.ignoreWarnings = [/Failed to parse source map/] return config }
thanks bro
from invariant-packages.
thanks bro
from invariant-packages.
Related Issues (20)
- `process = { env: {} }` leaks into global namespace HOT 3
- Invariant Violation: 9 HOT 2
- Enable CircleCI HOT 1
- Usage of const keyword in ts-invariant package HOT 2
- Instructions are way too vague HOT 3
- Invariant Violation: Invariant Violation: 44 HOT 5
- ES module support (ts-invariant\process) HOT 3
- How to skip invariant in webpack? HOT 2
- Failed to parse source map warning HOT 3
- SyntaxError: Unexpected token - rollup-plugin-invariant
- Typescript nodenext module issue
- Parentheses added inside href in error message (Nextjs) creating broken links
- breaks gatsby build with "Invariant Violation: 1" HOT 12
- This repo is the landing page for error messages that it doesn't help with
- ts-invariant TS config missing "node" type HOT 1
- Explain in README how ts-invariant is different than `invariant` HOT 3
- Does anyone know where the reference to @types/node is coming from? HOT 2
- Make process stub writeable.
- Incompatibility since version 0.5.1 with commonjs modules HOT 4
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 invariant-packages.