Merge branch 'no-more-webpacker-yml' into 'develop'
Move out of webpacker.yml, fixes #469 Closes #469 See merge request soapbox-pub/soapbox-fe!339
This commit is contained in:
commit
285e5ef3eb
3 changed files with 17 additions and 79 deletions
|
@ -79,7 +79,6 @@
|
||||||
"intl-messageformat-parser": "^6.0.0",
|
"intl-messageformat-parser": "^6.0.0",
|
||||||
"intl-pluralrules": "^1.1.1",
|
"intl-pluralrules": "^1.1.1",
|
||||||
"is-nan": "^1.2.1",
|
"is-nan": "^1.2.1",
|
||||||
"js-yaml": "^3.13.1",
|
|
||||||
"lodash": "^4.7.11",
|
"lodash": "^4.7.11",
|
||||||
"mark-loader": "^0.1.6",
|
"mark-loader": "^0.1.6",
|
||||||
"marky": "^1.2.1",
|
"marky": "^1.2.1",
|
||||||
|
|
|
@ -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
|
|
|
@ -1,17 +1,28 @@
|
||||||
// Common configuration for webpacker loaded from config/webpacker.yml
|
|
||||||
|
|
||||||
const { join } = require('path');
|
const { join } = require('path');
|
||||||
const { env } = require('process');
|
const { env } = require('process');
|
||||||
const { safeLoad } = require('js-yaml');
|
|
||||||
const { readFileSync } = require('fs');
|
|
||||||
|
|
||||||
const configPath = join(__dirname, 'config', 'webpacker.yml');
|
const settings = {
|
||||||
const settings = safeLoad(readFileSync(configPath), 'utf8')[env.NODE_ENV];
|
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) {
|
function removeOuterSlashes(string) {
|
||||||
return string.replace(/^\/*/, '').replace(/\/*$/, '');
|
return string.replace(/^\/*/, '').replace(/\/*$/, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getPublicOutputPath() {
|
||||||
|
if (env.NODE_ENV === 'test') {
|
||||||
|
return 'packs-test';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'packs';
|
||||||
|
}
|
||||||
|
|
||||||
function formatPublicPath(host = '', path = '') {
|
function formatPublicPath(host = '', path = '') {
|
||||||
let formattedHost = removeOuterSlashes(host);
|
let formattedHost = removeOuterSlashes(host);
|
||||||
if (formattedHost && !/^http/i.test(formattedHost)) {
|
if (formattedHost && !/^http/i.test(formattedHost)) {
|
||||||
|
|
Loading…
Reference in a new issue