mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-18 07:51:55 +03:00
3f71eccc77
no-issue When installing this module in another project, we want to serve the entire `dist` directory as-is, on whichever path we want, rather than enforicing a /static after the relative part.
27 lines
987 B
JavaScript
27 lines
987 B
JavaScript
export default function (config, env, helpers) {
|
|
const postcssLoader = helpers.getLoadersByName(config, 'postcss-loader');
|
|
const cssLoader = helpers.getLoadersByName(config, 'css-loader');
|
|
postcssLoader.forEach(({loader}) => (delete loader.options));
|
|
cssLoader.forEach(({loader}) => (delete loader.options));
|
|
|
|
helpers.getRulesByMatchingFile(config, '*.css').forEach(({rule}) => {
|
|
let filter = (rule.include || rule.exclude || []);
|
|
let newFilter = filter[0].replace('/components', '/styles');
|
|
filter.push(newFilter);
|
|
});
|
|
|
|
if (env.production) {
|
|
config.output.publicPath = '';
|
|
} else {
|
|
config.output.publicPath = 'http://localhost:8080/';
|
|
}
|
|
config.devServer = {
|
|
quiet: true,
|
|
headers: {
|
|
'Access-Control-Allow-Origin': '*',
|
|
'Access-Control-Allow-Methods': '*',
|
|
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization'
|
|
}
|
|
};
|
|
}
|