Move out of webpacker.yml

patch-2
Sean King 2020-10-08 08:43:00 -06:00
rodzic fb092714e7
commit 0316c7cf72
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 510C52BACD6E7257
3 zmienionych plików z 17 dodań i 79 usunięć

Wyświetl plik

@ -79,7 +79,6 @@
"intl-messageformat-parser": "^6.0.0",
"intl-pluralrules": "^1.1.1",
"is-nan": "^1.2.1",
"js-yaml": "^3.13.1",
"lodash": "^4.7.11",
"mark-loader": "^0.1.6",
"marky": "^1.2.1",

Wyświetl plik

@ -1,72 +0,0 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect
default: &default
source_path: app
public_root_path: static
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: false
# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: []
# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false
# Extract and emit a css file
extract_css: true
static_assets_extensions:
- .jpg
- .jpeg
- .png
- .tiff
- .ico
- .svg
- .gif
- .eot
- .otf
- .ttf
- .woff
- .woff2
extensions:
- .mjs
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
compile: true
test:
<<: *default
# CircleCI precompiles packs prior to running the tests.
# Also avoids race conditions in parallel_tests.
compile: false
# Compile test packs to a separate directory
public_output_path: packs-test
production:
<<: *default
# Production depends on precompilation of packs prior to booting for performance.
compile: false
# Cache manifest.json for performance
cache_manifest: true

Wyświetl plik

@ -1,17 +1,28 @@
// Common configuration for webpacker loaded from config/webpacker.yml
const { join } = require('path');
const { env } = require('process');
const { safeLoad } = require('js-yaml');
const { readFileSync } = require('fs');
const configPath = join(__dirname, 'config', 'webpacker.yml');
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
const settings = {
source_path: 'app',
public_root_path: 'static',
public_output_path: getPublicOutputPath(),
cache_path: 'tmp/cache/webpacker',
resolved_paths: [],
static_assets_extensions: [ '.jpg', '.jpeg', '.png', '.tiff', '.ico', '.svg', '.gif', '.eot', '.otf', '.ttf', '.woff', '.woff2' ],
extensions: [ '.mjs', '.js', '.sass', '.scss', '.css', '.module.sass', '.module.scss', '.module.css', '.png', '.svg', '.gif', '.jpeg', '.jpg' ],
};
function removeOuterSlashes(string) {
return string.replace(/^\/*/, '').replace(/\/*$/, '');
}
function getPublicOutputPath() {
if (env.NODE_ENV === 'test') {
return 'packs-test';
}
return 'packs';
}
function formatPublicPath(host = '', path = '') {
let formattedHost = removeOuterSlashes(host);
if (formattedHost && !/^http/i.test(formattedHost)) {