We have 2 different builds of our dojo application, using either ourapp.profile.js or ourapp.custom.profile.js which contain the dojo application build profile.
Apart from a few differences in the layers property the rest of these 2 files are virtually identical. What's the best way to share the common settings between these 2 files?
Here's a simplified example of one our application profiles
var profile = (function () {
'use strict';
return {
basePath: "../",
releaseDir: "../../../build",
releaseName: "js",
action: "release",
dirs: ["../css", "../css/font", "../img", "../img/icons", "../stylus/themes/common"],
packages: [
{
name: "dbootstrap",
location: "dbootstrap"
},
{
name: "dgrid",
location: "dgrid"
},
{
name: "dstore",
location: "dstore"
},
{
name: "dijit",
location: "dijit"
},
{
name: "dojo",
location: "dojo"
},
{
name: "dojox",
location: "dojox"
},
{
name: "ourapp",
location: "ourapp"
},
{
name: "lib",
location: "lib"
},
{
name: "xstyle",
location: "xstyle"
},
{
name: "specs",
location: "specs"
}
],
layers: {
"dojo/dojo": {
include: [
"dojo/dojo",
"dojo/i18n",
"dojo/domReady",
"ourapp/boot",
// more includes
...
],
customBase: true,
boot: true,
},
// other layers
...
},
layerOptimize: "closure",
optimize: "closure",
cssOptimize: "comments",
mini: 1,
stripConsole: "warn",
selectorEngine: "lite",
insertAbsMids: false,
staticHasFeatures: {
"config-deferredInstrumentation": 0,
// More settings
..
},
defaultConfig: {
hasCache: {
"dojo-built": 1,
"dojo-loader": 1,
"dom": 1,
"host-browser": 1,
"config-selectorEngine": "lite"
},
async: 1
}
};
})();
Ideally we'd like both files to share one common set of settings and just specify the parts that differ in our 2 application profiles.
Update:
This page talks about multiple profile sources so I'm going to try splitting out the common parts to another profile file then when building running something like:
>build.bat --profile ourapp.shared.profile.js --profile ourapp.profile.js
or
>build.bat --profile ourapp.shared.profile.js --profile ourapp.custom.profile.js
Has anyone tried something similar?
The approach suggested in the Update to the question does work, but isn't very well documented about how different profile properties are combined or replaced so required some trial and error as certain properties are treated differently.
What we have now is the profile shown in the question (ourapp.profile.js), and ourapp.custom.profile.js as follows:
var profile = (function () {
'use strict';
return {
basePath: "../",
releaseName: "js-custom",
packages: [
{
name: "ourapp",
location: "ourapp-custom"
}}
]
};
})();
Now for our custom build we run this from the command line:
build.bat --profile ourapp.profile.js --profile ourapp.custom.profile.js
The properties in ourapp.custom.profile.js replace those in ourapp.profile.js changing the release name to 'js-custom' and replace the standard ourapp package with an alternative one in ourapp-custom.
Related
i am trying to use aws ecr for my serverless application but i am failing to do so,
my main problem is the 50mb upload limit lambda has, and this is the config in my serverless (i am not sure if it is correct since there is not lots of documentation about it online)
(i am using aws-nodejs-typescript template)
addFriend is the function that i am trying to build with docker.
this is my Dockerfile
FROM public.ecr.aws/lambda/nodejs:14 as builder
WORKDIR /usr/app
COPY package.json handler.ts ./
RUN npm install
RUN npm run build
FROM public.ecr.aws/lambda/nodejs:14
WORKDIR ${LAMBDA_TASK_ROOT}
COPY --from=builder /usr/app/dist/* ./
CMD ["handler.main"]
and my serverless.ts
const serverlessConfiguration: AWS = {
...
custom: {
esbuild: {
bundle: true,
minify: false,
sourcemap: true,
exclude: ['aws-sdk'],
target: 'node14',
define: { 'require.resolve': undefined },
platform: 'node',
},
...
},
plugins: ['serverless-esbuild'],
provider: {
name: 'aws',
runtime: 'nodejs14.x',
profile: <PROFILE>,
region: 'us-east-1',
stage: 'dev',
apiGateway: {
minimumCompressionSize: 1024,
shouldStartNameWithService: true,
},
iamRoleStatements: [
{
Effect: 'Allow',
Action: ['s3:*', 'sns:*'],
Resource: '*',
},
],
ecr: {
images: {
addfriendfunction: {
path: './src/functions/addFriend',
},
},
},
lambdaHashingVersion: '20201221',
},
functions: {
...
addPushToken,
addFriend: {
image: {
name: 'addfriendfunction',
},
events: [
{
http: {
method: 'get',
path: 'api/v1/add-friend',
},
},
],
},
the error in the console is:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type
string. Received undefined
i am stuck with this issue unable to continue working, is there any solution for this with serverless framework?
Follow this guide for nodejs.
Can you try copy js code. For example something like: .esbuild/.build/src/functions/addFriend/handler.js instead of this step:
COPY package.json handler.ts ./
I have an AWS Appflow flow against Salesforce. These are the properties:
{
description: 'salesforce_Account',
kMSArn: 'arn:aws:kms:us-west-2:<account_id>:key/e8e57dff-31ab-42c9-a997-2da88ffa3fa7',
destinationFlowConfigList: [
{
connectorType: 'S3',
destinationConnectorProperties: {
s3: {
bucketName: 'kavak-landing-raw-prod',
bucketPrefix: 'salesforce',
s3OutputFormatConfig: {
aggregationConfig: {
aggregationType: 'None',
},
fileType: 'PARQUET',
prefixConfig: {
prefixFormat: 'MONTH',
prefixType: 'PATH',
},
},
},
},
},
],
flowName: 'salesforce_Account',
sourceFlowConfig: {
connectorProfileName: 'appflow-salesforce-conn',
connectorType: 'Salesforce',
incrementalPullConfig: {
datetimeTypeFieldName: 'LastModifiedDate',
},
sourceConnectorProperties: {
salesforce: {
enableDynamicFieldUpdate: true,
includeDeletedRecords: true,
object: 'Account',
},
},
},
tasks: [
{
connectorOperator: {
salesforce: 'NO_OP',
},
sourceFields: [],
taskProperties: [
{
key: 'EXCLUDE_SOURCE_FIELDS_LIST',
value: '[]',
},
],
taskType: 'Map_all',
},
],
triggerConfig: {
triggerProperties: {
dataPullMode: 'Incremental',
scheduleExpression: 'rate(30minutes)',
},
triggerType: 'Scheduled',
},
}
The flow runs without problems, but I'm facing an issue. The issue is that, when I see the folder structure in S3 the flow is generating an additional folder before the Parquet files. These folders corresponds with the execution ID of each flow run. Here are some printscreens:
So, my question is why are these folders being created? Is it Appflow normal behavior? Or is it something related to the flow properties? I couldn't find anything in the official documentation or recent posts online regarding this issue. Can anybody help me understand this?
Thanks!
I have an app (Vite + React) that depends on a library that makes use of dynamic imports in the form of:
const { T } = useLocale(({ locale }) => require(`./i18n/${locale}.json`));
Unfortunately, I can't seem to be able to build my app due to this line. When I attempt to build with Vite, I get errors such as:
Not supported dynamic import, file:/Users/borne/Work/prototype/node_modules/#internal/top-navigation/es/Navigation.js
I added the legacy plugin to my configs, as well as the CommonJs solution as described here:
https://www.npmjs.com/package/#originjs/vite-plugin-commonjs
But it didn't seem to change anything.
This is my config:
import {defineConfig} from 'vite';
import react from '#vitejs/plugin-react';
import babel from 'vite-plugin-babel';
import { viteCommonjs, esbuildCommonjs } from '#originjs/vite-plugin-commonjs';
import legacy from '#vitejs/plugin-legacy';
const fs = require('fs');
export default defineConfig({
plugins: [
viteCommonjs(),
babel(),
react({
babel: {
parserOpts: {
plugins: ['decorators-legacy']
}
},
}),
legacy({
targets: ['defaults', 'not IE 11']
}),
],
optimizeDeps: {
esbuildOptions: {
plugins: [
esbuildCommonjs([
'#internal/top-navigation',
]),
],
},
},
server: {
hmr: {
clientPort: 443,
},
https: {
key: fs.readFileSync('./.cert/key.pem'),
cert: fs.readFileSync('./.cert/cert.pem'),
},
},
define: {
'process.env': {},
'global': {}
}
})
What am I missing?
This is what I have tried in my vue.config.js:
module.exports = {
configureWebpack: {
optimization: {
splitChunks: {
cacheGroups: {
styles: {
name: 'styles',
test: /\.css$/,
chunks: 'all',
enforce: true,
},
},
},
},
},
css: {
sourceMap: devMode,
extract: {
filename: 'main.css',
},
},
};
I'm getting multiple css files in my output dir and I would like to merge/optimise all them into a single file. I have multiple chunks created by dynamic import and am not sure if that's the cause.
In my old webpack template with previous CLI I used extract-text-webpack-plugin for the job and it worked.
I found some discussions in the issues below but at the time of this question no solutions yet.
mini-css-extract-plugin #41
mini-css-extract-plugin #52
when i use webpack4.2.0, play 'run start', show errors follow:
WARNING in configuration
The 'mode' option has not been set. Set 'mode' option to 'development' or 'production' to enable defaults for this environment.
ERROR in multi (webpack)-dev-server/client?http://localhost:8001 ./src
Module not found: Error: Can't resolve './src' in '/Users/xudengwei/projects/xudengwei/myOpenGithub/angular5-scaffold'
# multi (webpack)-dev-server/client?http://localhost:8001 ./src
ℹ 「wdm」: Failed to compile.
#
my configure as follow:
webpack.common.js:
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
'polyfills': './src/polyfills.ts',
'vendor': './src/vendor.ts',
'app': './src/app/main.ts'
},
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "ts-loader"
}
]
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: true
})
]
};
webpack.dev.js:
var path = require('path');
var webpackMerge = require('webpack-merge');
var commonConfig = require('./webpack.common.js');
module.exports = webpackMerge(commonConfig, {
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
chunkFilename: '[id].chunk.js'
},
module: {
rules: []
},
plugins: [
new HtmlWebpackPlugin({
template: './index.html',
inject: true
})
],
devServer: {
devServer: {
contentBase: './dist'
},
}
});
someone knows the reason?thanks
I also just get this error like you got and its was solved when i specify webpack config file. Try to add --config when you run webpack-dev-server. Ex. webpack-dev-server --config webpack.dev.js
what command did you run in the terminal? It looks to me like you used run start ./src and so it's complaining that it can't find the location ./scr
Try just running run start with no additional arguments. That did the trick for me