Skip to content

Commit 5179f30

Browse files
author
Christopher Willis-Ford
committed
Remove resolve: { symlinks: false }, fix fallout
Turning off symlink resolution in webpack was a quick fix but complicates things by making webpack act less like Node.js than it otherwise would. This change restores default symlink resolution behavior for webpack, which matches Node. In order to make Babel work with `npm link`ed modules even when symlink resolution is enabled, the include paths for `babel-loader` are now being run through `fs.realpathSync`.
1 parent 4f095b7 commit 5179f30

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

webpack.config.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var CopyWebpackPlugin = require('copy-webpack-plugin');
22
var defaultsDeep = require('lodash.defaultsdeep');
3+
var fs = require('fs');
34
var path = require('path');
45
var webpack = require('webpack');
56

@@ -18,7 +19,7 @@ var base = {
1819
path.resolve(__dirname, 'node_modules', 'scratch-render', 'src'),
1920
path.resolve(__dirname, 'node_modules', 'scratch-storage', 'src'),
2021
path.resolve(__dirname, 'src')
21-
],
22+
].map(path => fs.realpathSync(path)),
2223
test: /\.js$/,
2324
loader: 'babel-loader',
2425
options: {
@@ -32,10 +33,7 @@ var base = {
3233
include: /\.min\.js$/,
3334
minimize: true
3435
})
35-
],
36-
resolve: {
37-
symlinks: false
38-
}
36+
]
3937
};
4038

4139
module.exports = [
@@ -102,15 +100,15 @@ module.exports = [
102100
loader: 'expose-loader?Blockly'
103101
},
104102
{
105-
test: path.resolve(__dirname, 'node_modules', 'scratch-audio', 'src', 'index.js'),
103+
test: require.resolve('scratch-audio'),
106104
loader: 'expose-loader?AudioEngine'
107105
},
108106
{
109-
test: path.resolve(__dirname, 'node_modules', 'scratch-render', 'src', 'index.js'),
107+
test: require.resolve('scratch-render'),
110108
loader: 'expose-loader?RenderWebGL'
111109
},
112110
{
113-
test: path.resolve(__dirname, 'node_modules', 'scratch-storage', 'src', 'index.js'),
111+
test: require.resolve('scratch-storage'),
114112
loader: 'expose-loader?Scratch.Storage'
115113
}
116114
])

0 commit comments

Comments
 (0)