How to use the hops-config.assetPath function in hops-config

To help you get started, we’ve selected a few hops-config examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xing / hops / packages / lambda / lambda.js View on Github external
'use strict';

process.env.NODE_ENV = 'production';

const serverlessHttp = require('serverless-http');
const config = require('hops-config');
const { trimSlashes } = require('pathifist');

const app = require('@untool/express').createServer('serve');

const awsConfig = require('./lib/aws-config')(config);

const shouldIncludeStageInRequest =
  trimSlashes(config.basePath).indexOf(awsConfig.stageName) === 0 &&
  trimSlashes(config.assetPath).indexOf(awsConfig.stageName) === 0;

// NOTE: If you get ERR_CONTENT_DECODING_FAILED in your browser, this is likely
// due to a compressed response (e.g. gzip) which has not been handled correctly
// by serverless-http and/or API Gateway. Add the necessary MIME types to
// binaryMimeTypes below, then redeploy.
const binaryMimeTypes = [
  'application/javascript',
  'application/json',
  'application/octet-stream',
  'application/xml',
  'font/eot',
  'font/opentype',
  'font/otf',
  'font/woff',
  'font/woff2',
  'image/jpeg',
github xing / hops / packages / build-config / configs / develop.js View on Github external
'use strict';

var path = require('path');

var webpack = require('webpack');

var ServiceWorkerPlugin = require('../plugins/service-worker');

var hopsConfig = require('hops-config');

var getAssetPath = path.join.bind(path, hopsConfig.assetPath);

module.exports = {
  mode: 'development',
  entry: [
    require.resolve('webpack-hot-middleware/client'),
    require.resolve('../shims/develop'),
  ],
  output: {
    path: hopsConfig.buildDir,
    publicPath: '/',
    pathinfo: true,
    filename: getAssetPath('[name].js'),
    chunkFilename: getAssetPath('chunk-[id].js'),
    devtoolModuleFilenameTemplate: function(info) {
      return path.resolve(info.absoluteResourcePath).replace(/\\/g, '/');
    },
github xing / hops / packages / build-config / sections / module-rules / file.js View on Github external
'use strict';

var path = require('path');

var hopsConfig = require('hops-config');

exports.default = {
  exclude: /\.(?:m?jsx?|html|json)$/,
  loader: require.resolve('file-loader'),
  options: {
    name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
  },
};

exports.node = {
  exclude: /\.(?:m?jsx?|html|json)$/,
  loader: require.resolve('file-loader'),
  options: {
    name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
    emitFile: false,
  },
};
github xing / hops / packages / build-config / sections / module-rules / webmanifest.js View on Github external
'use strict';

var path = require('path');

var hopsConfig = require('hops-config');

exports.default = {
  test: /\.webmanifest$/,
  use: [
    {
      loader: require.resolve('file-loader'),
      options: {
        name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
      },
    },
    {
      loader: require.resolve('../../loaders/webmanifest'),
    },
  ],
};

exports.node = {
  test: /\.webmanifest$/,
  use: [
    {
      loader: require.resolve('file-loader'),
      options: {
        name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
        emitFile: false,
github xing / hops / packages / build-config / sections / module-rules / url.js View on Github external
'use strict';

var path = require('path');

var hopsConfig = require('hops-config');

exports.default = {
  test: /\.(png|gif|jpe?g|webp)$/,
  loader: require.resolve('url-loader'),
  options: {
    limit: 10000,
    name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
  },
};
github xing / hops / packages / build-config / configs / build.js View on Github external
'use strict';

var path = require('path');

var webpack = require('webpack');
var StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
var ServiceWorkerPlugin = require('../plugins/service-worker');
var ExtractTextPlugin = require('extract-text-webpack-plugin');

var hopsConfig = require('hops-config');

var getAssetPath = path.join.bind(path, hopsConfig.assetPath);

module.exports = {
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
  bail: true,
  entry: require.resolve('../shims/build'),
  output: {
    path: hopsConfig.buildDir,
    publicPath: '/',
    pathinfo: true,
    filename: getAssetPath('[name]-[chunkhash:16].js'),
    chunkFilename: getAssetPath('[name]-[chunkhash:16].js'),
    devtoolModuleFilenameTemplate: function(info) {
      return path
        .relative(hopsConfig.appDir, info.absoluteResourcePath)
        .replace(/\\/g, '/');
    },
github xing / hops / packages / build-config / sections / module-rules / webmanifest.js View on Github external
name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
      },
    },
    {
      loader: require.resolve('../../loaders/webmanifest'),
    },
  ],
};

exports.node = {
  test: /\.webmanifest$/,
  use: [
    {
      loader: require.resolve('file-loader'),
      options: {
        name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
        emitFile: false,
      },
    },
    {
      loader: require.resolve('../../loaders/webmanifest'),
    },
  ],
};
github xing / hops / packages / build-config / configs / build.js View on Github external
'use strict';

var path = require('path');

var webpack = require('webpack');
var StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin;
var ServiceWorkerPlugin = require('../plugins/service-worker');
var MiniCSSExtractPlugin = require('mini-css-extract-plugin');
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');

var hopsConfig = require('hops-config');

var getAssetPath = path.join.bind(path, hopsConfig.assetPath);

module.exports = {
  mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
  bail: true,
  entry: require.resolve('../shims/build'),
  output: {
    path: hopsConfig.buildDir,
    publicPath: '/',
    pathinfo: true,
    filename: getAssetPath('[name]-[chunkhash:16].js'),
    chunkFilename: getAssetPath('[name]-[chunkhash:16].js'),
    devtoolModuleFilenameTemplate: function(info) {
      return path
        .relative(hopsConfig.appDir, info.absoluteResourcePath)
        .replace(/\\/g, '/');
    },
github xing / hops / packages / build-config / sections / module-rules / file.js View on Github external
var hopsConfig = require('hops-config');

exports.default = {
  exclude: /\.(?:m?jsx?|html|json)$/,
  loader: require.resolve('file-loader'),
  options: {
    name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
  },
};

exports.node = {
  exclude: /\.(?:m?jsx?|html|json)$/,
  loader: require.resolve('file-loader'),
  options: {
    name: path.join(hopsConfig.assetPath, '[name]-[hash:16].[ext]'),
    emitFile: false,
  },
};