Comments (12)
Customize the loader you get in defaults.module.rules
to exclude your file.
https://github.com/callstack-io/haul/blob/master/docs/Configuration.md
https://webpack.js.org/configuration/module/#rule-exclude
from haul.
@satya164 thanks for reply
wepack.haul.js
var path = require('path')
module.exports = ({ platform },defaults) => ({
entry: `./index.${platform}.js`,
module: {
...defaults.module,
rules: [
...defaults.module.rules,
{
test: /\.js$/,
exclude: [/node_modules\/(?!react|@expo|haul)/,
path.resolve(__dirname, 'assets/scalajs-output-ios.js')
],
use: {
loader: require.resolve('happypack/loader'),
query: { id: 'babel' },
},
},
],
}
});
index.ios.js
require("./assets/scalajs-output-ios.js")
yarn run haul start -- --platform ios
but build is struck at 20%
INFO Ready at http://localhost:8081
Haul is now bundling your React Native app, starting from:
/projectpath/index.ios.js
A fresh build may take longer than usual
[==== ] 20%
from haul.
you'll want to filter it out from defaults.module.rules
too
from haul.
you'll want to filter it out from defaults.module.rules too
i didn't understand this fully,
but my scalajs-output-ios.js
is already ES5 , it's redundant to pass it through babel again :s
from haul.
You already have this rule in defaults.module.rules
, if you don't filter it, then you have two rules for js
from haul.
oh ok got you, so i have to filter defaults.module.rules
before merging right ?
from haul.
@satya164 its good to provide some option
to provide extra excludes
and merge them in default .js
rules ?
from haul.
I think in that case instead of merging your rules with default rules, you better providing your own set of rules and forgetting about ours at all. We export an array, so you can take whatever you want by index.
from haul.
I guess better not to rely on index since it'll break when if we add any loaders, but defaults.module.rules.filter
before merging should be fine
from haul.
i think i don't know what i am doing here :( , with this following config , i see build going until 91%
webpack.haul.js
var path = require('path')
module.exports = ({ platform },defaults) => ({
entry: `./index.${platform}.js`,
module: {
...defaults.module,
rules: [
...(defaults.module.rules.filter((obj) => {
console.log(obj.test);
obj.test != `/\.js$/` })),
{
test: /\.js$/,
exclude: [/node_modules\/(?!react|@expo|haul)/,
path.resolve(__dirname, 'assets/scalajs-output-ios.js')],
use: {
loader: require.resolve('happypack/loader'),
query: { id: 'babel' },
},
},
],
}
});
but in the end i am seeing bunch of following errors
ERROR in ./~/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactRef.js
Module parse failed: project_path/node_modules/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactRef.js Unexpected token (17:12)
You may need an appropriate loader to handle this file type.
| var ReactOwner = require('ReactOwner');
|
| import type { ReactInstance } from 'ReactInstanceType';
| import type { ReactElement } from 'ReactElementType';
|
@ ./~/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactReconciler.js 14:15-34
@ ./~/react-native/Libraries/Renderer/src/renderers/shared/stack/reconciler/ReactUpdates.js
@ ./~/react-native/Libraries/react-native/react-native-implementation.js
@ ./assets/scalajs-output-ios.js
@ ./index.ios.js
@ multi ./~/haul-cli/src/utils/polyfillEnvironment.js ./index.ios.js
from haul.
On a side note - since this is Webpack - I believe a more efficient way would be to explicitly override loader
for that particular require rather than adding it to exclude
list.
Revert back you Haul config to what it used to be in the first commend and replace require
with the following:
require("!!./assets/scalajs-output-ios.js")
The double exclamation mark will disable all preloaders and loaders for that particular call.
from haul.
@grabbou thanks for info , I don't know what added recently, its working fine now without any hacks.
from haul.
Related Issues (20)
- Getting Source Maps to Work HOT 3
- Stack-Traces not showing up correctly in client
- Haul not working with Amazon aws sdk HOT 4
- Debug is not working
- Time out requesting http://localhost:8081/onchange on iOS HOT 1
- How to use multi-bundle? HOT 1
- How to use alias path in haul?
- Module.createRequireFromPath() is deprecated.
- Production Build Error With React Navigation Stack HOT 3
- Asset naming algorithm causes ENAMETOOLONG when using react-navigation and pnpm
- Where to find a changelog? HOT 3
- `haul init` stuck on updating Babel configuration
- Initialisation is hanging on package.json edit HOT 2
- Presets for RN 0.61+? HOT 5
- Support other browsers (eg: user-chosen defaults)
- Crashing when launching Chrome debugger
- haul is not working on existing app
- haul out of memory on reload
- update the lockfile to automatically remove the high severity vulnerability introduced in @haul-bundler/core
- Haul server crashes when navigating to root url
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 haul.