Skip to content

Commit 9988bd5

Browse files
Add an example that uses symfony/webpack-encore#115
1 parent f9c3282 commit 9988bd5

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

karma.conf.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
1-
// Generate Encore runtimeConfig
2-
const context = require('@symfony/webpack-encore/lib/context');
3-
const parseRuntime = require('@symfony/webpack-encore/lib/config/parse-runtime');
1+
const Encore = require('@symfony/webpack-encore');
42
const ManifestPlugin = require('@symfony/webpack-encore/lib/webpack/webpack-manifest-plugin');
53

6-
const encoreArgs = ['dev-server'];
7-
context.runtimeConfig = parseRuntime(
8-
require('yargs').parse(encoreArgs),
9-
process.cwd()
10-
);
4+
// Initialize Encore before requiring the .config file
5+
Encore.configureRuntimeEnvironment('dev-server');
116

127
// Retrieve webpack config
138
const webpackConfig = require('./webpack.config');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"test": "karma start --single-run"
66
},
77
"devDependencies": {
8-
"@symfony/webpack-encore": "^0.12.0",
8+
"@symfony/webpack-encore": "git+https://github.com/lyrkan/webpack-encore.git#add-configure-runtime-environment",
99
"jasmine": "^2.6.0",
1010
"karma": "^1.7.0",
1111
"karma-jasmine": "^1.1.0",

webpack.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// webpack.config.js
2-
var Encore = require('@symfony/webpack-encore');
2+
const Encore = require('@symfony/webpack-encore');
33

44
Encore
55
// directory where all compiled assets will be stored

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# yarn lockfile v1
33

44

5-
"@symfony/webpack-encore@^0.12.0":
5+
"@symfony/webpack-encore@git+https://github.com/lyrkan/webpack-encore.git#add-configure-runtime-environment":
66
version "0.12.0"
7-
resolved "https://registry.yarnpkg.com/@symfony/webpack-encore/-/webpack-encore-0.12.0.tgz#1502d7b843bc28c2643f495796cecfbe19587bef"
7+
resolved "git+https://github.com/lyrkan/webpack-encore.git#ce6e7d3698b7c0995a18266a050559d1c39a8cb4"
88
dependencies:
99
babel-core "^6.24.0"
1010
babel-loader "^7.1.0"

0 commit comments

Comments
 (0)