You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 1, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
-65
Original file line number
Diff line number
Diff line change
@@ -114,8 +114,6 @@ npm run build --rollup ./config/rollup.config.js
114
114
| src directory |`ionic_src_dir`|`--srcDir`|`src`| The directory holding the Ionic src code |
115
115
| www directory |`ionic_www_dir`|`--wwwDir`|`www`| The deployable directory containing everything needed to run the app |
116
116
| build directory |`ionic_build_dir`|`--buildDir`|`build`| The build process uses this directory to store generated files, etc |
117
-
| Pre-Bundle hook |`ionic_pre_bundle_hook`|`--preBundleHook`|`null`| Path to file that implements the hook |
118
-
| Post-Bundle hook |`ionic_post_bundle_hook`|`--postBundleHook`|`null`| Path to file that implements the hook |
119
117
120
118
121
119
### Ionic Environment Variables
@@ -132,8 +130,6 @@ These environment variables are automatically set to [Node's `process.env`](http
132
130
|`IONIC_BUILD_DIR`| The absolute path to the app's bundled js and css files. |
133
131
|`IONIC_APP_SCRIPTS_DIR`| The absolute path to the `@ionic/app-scripts` node_module directory. |
134
132
|`IONIC_SOURCE_MAP`| The Webpack `devtool` setting. We recommend `eval` or `source-map`. |
135
-
|`IONIC_PRE_BUNDLE_HOOK`| The absolute path to the file that implements the hook. |
136
-
|`IONIC_POST_BUNDLE_HOOK`| The absolute path to the file that implements the hook. |
137
133
138
134
The `process.env.IONIC_ENV` environment variable can be used to test whether it is a `prod` or `dev` build, which automatically gets set by any command. By default the `build` task is `prod`, and the `watch` and `serve` tasks are `dev`. Additionally, using the `--dev` command line flag will force the build to use `dev`.
139
135
@@ -166,67 +162,6 @@ Example NPM Script:
166
162
},
167
163
```
168
164
169
-
## Hooks
170
-
Injecting dynamic data into the build is accomplished via hooks. Hooks are functions for performing actions like string replacements. Hooks *must* return a `Promise` or the build process will not work correctly.
171
-
172
-
For now, two hooks exist: the `pre-bundle` and `post-bundle` hooks.
173
-
174
-
To get started with a hook, add an entry to the `package.json` config section
// do something interesting and resolve the promise
190
-
});
191
-
}
192
-
```
193
-
194
-
`context` is the app-scripts [BuildContext](https://github.com/driftyco/ionic-app-scripts/blob/master/src/util/interfaces.ts#L4-L24) object. It contains all of the paths and information about the application.
195
-
196
-
`isUpdate` is a boolean informing the user whether it is the initial full build (false), or a subsequent, incremental build (true).
197
-
198
-
`changedFiles` is a list of [File](https://github.com/driftyco/ionic-app-scripts/blob/master/src/util/interfaces.ts#L61-L65) objects for any files that changed as part of an update. `changedFiles` is null for full builds, and a populated list when `isUpdate` is true.
199
-
200
-
`configFile` is the config file corresponding to the hook's utility. For example, it could be the rollup config file, or the webpack config file depending on what the value of `ionic_bundler` is set to.
201
-
202
-
### Example Hooks
203
-
204
-
Here is an example of doing string replacement. We're injecting the git commit hash into our application using the `ionic_pre_bundle_hook`.
205
-
206
-
```
207
-
var execSync = require('child_process').execSync;
208
-
209
-
// the pre-bundle hook happens after the TypeScript code has been transpiled, but before it has been bundled together.
210
-
// this means that if you want to modify code, you're going to want to do so on the in-memory javascript
1. The Webpack `devtool` setting is driven by the `ionic_source_map` variable. It defaults to `eval` for fast builds, but can provide the original source map by changing the value to `source-map`. There are additional values that Webpack supports, but we only support `eval` and `source-maps` for now.
0 commit comments