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
The import only works after a recompile, ever first compilation gives an import error, but if I retry with any change on file (new line, on this example) it works fine. I have no guess why
Here is a compilation log:
$ MY_ENV=dev ionic-app-scripts serve
[19:45:14] ionic-app-scripts 3.1.10
[19:45:14] watch started ...
[19:45:14] build dev started ...
[19:45:14] clean started ...
[19:45:14] clean finished in 5 ms
[19:45:14] copy started ...
[19:45:14] deeplinks started ...
[19:45:14] deeplinks finished in 34 ms
[19:45:14] transpile started ...
[19:45:17] typescript: src/providers/authentication/authentication.ts, line: 5
Cannot find module '@app/env'.
L4: import 'rxjs/add/operator/map';
L5: import { API } from '@app/env';
[19:45:17] dev server running: http://localhost:8100/
[19:45:17] copy finished in 2.65 s
[19:45:17] watch ready in 2.69 s
[19:45:22] build started ...
[19:45:22] deeplinks update started ...
[19:45:22] deeplinks update finished in 24 ms
[19:45:22] transpile update started ...
[19:45:22] transpile update finished in 41 ms
[19:45:22] webpack started ...
[19:45:34] webpack finished in 12.61 s
[19:45:34] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[19:45:35] sass finished in 819 ms
[19:45:35] build finished in 13.56 s
/*
* The webpack config exports an object that has a valid webpack configuration
* For each environment name. By default, there are two Ionic environments:
* "dev" and "prod". As such, the webpack.config.js exports a dictionary object
* with "keys" for "dev" and "prod", where the value is a valid webpack configuration
* For details on configuring webpack, see their documentation here
* https://webpack.js.org/configuration/
*/
var webpack = require('webpack');
var chalk = require("chalk");
var fs = require('fs');
var path = require('path');
var ionicWebpackFactory = require(process.env.IONIC_WEBPACK_FACTORY);
var ModuleConcatPlugin = require('webpack/lib/optimize/ModuleConcatenationPlugin');
var PurifyPlugin = require('@angular-devkit/build-optimizer').PurifyPlugin;
var useDefaultConfig = require('@ionic/app-scripts/config/webpack.config.js');
var env = process.env.MY_ENV;
useDefaultConfig.prod.resolve.alias = {
"@app/env": path.resolve(environmentPath('prod'))
};
useDefaultConfig.dev.resolve.alias = {
"@app/env": path.resolve(environmentPath('dev'))
};
useDefaultConfig.dev.plugins = [
ionicWebpackFactory.getIonicEnvironmentPlugin(),
ionicWebpackFactory.getCommonChunksPlugin(),
new webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
result.request = result.request.replace(/typeorm/, "typeorm/browser");
}),
new webpack.ProvidePlugin({
'window.SQL': 'sql.js/js/sql.js'
})
]
useDefaultConfig.prod.plugins = [
ionicWebpackFactory.getIonicEnvironmentPlugin(),
ionicWebpackFactory.getCommonChunksPlugin(),
new ModuleConcatPlugin(),
new PurifyPlugin(),
new webpack.NormalModuleReplacementPlugin(/typeorm$/, function (result) {
result.request = result.request.replace(/typeorm/, "typeorm/browser");
})
]
function environmentPath(env) {
var filePath = './src/environments/'+ env + '.ts';
if (!fs.existsSync(filePath)) {
console.log(chalk.red('\n' + filePath + ' does not exist!'));
} else {
return filePath;
}
}
module.exports = function () {
return useDefaultConfig;
};
I had some changes to run with typeorm and to find the file on a simpler path (environments/dev.ts ...).
But I don't see how they have to lead to this bug, anyone can help me to identify the problem here?
The text was updated successfully, but these errors were encountered:
The import only works after a recompile, ever first compilation gives an import error, but if I retry with any change on file (new line, on this example) it works fine. I have no guess why
Here is a compilation log:
Here is my
tsconfig
file:And here the
webpack
file:I had some changes to run with typeorm and to find the file on a simpler path (
environments/dev.ts
...).But I don't see how they have to lead to this bug, anyone can help me to identify the problem here?
The text was updated successfully, but these errors were encountered: