diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-08-08 18:15:16 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-08-08 18:15:16 +0300 |
commit | 23334ac0a151a60ada07b643f703dd0a75223094 (patch) | |
tree | c4e5271de7a5d4842b83179eb7899f9da479b39e /config/webpack.config.js | |
parent | 15441f0ef564e87f2ffb672452b0fb9d7bd1d44e (diff) | |
parent | 6a6a1e5b9e0a82735f786ffedeacc7cbc33ed7cd (diff) |
Merge branch 'master' into issue-discussions-refactor
* master: (481 commits)
Make sure that we have author and committer
disable file upload button while uploading
Fix bar chart does not display label at hour 0
Fixed activity not loading on project homepage
Expose noteable_iid in Note
Fix fly-out width when it has long items
Add a test to show that threshold 40 would corrupt
Add changelog entry
Raise encoding confidence threshold to 50
Fix the /projects/:id/repository/commits endpoint to handle dots in the ref name when the project full path contains a `/`
Fix the /projects/:id/repository/tags endpoint to handle dots in the tag name when the project full path contains a `/`
Add Italian translations of Pipeline Schedules
Restrict InlineJavaScript for haml_lint to dev and test environment
Incorporate Gitaly's CommitService.FindCommit RPC
Move `deltas` and `diff_from_parents` logic to Gitlab::Git::Commit
fix repo_edit_button_spec.js
fix test failures in repo_preview_spec.js
fix repo_loading_file_spec tests
Refactor Gitlab::Git::Commit to include a repository
use 100vh instead of flip flopping between the two - works on all suported browsers
...
Diffstat (limited to 'config/webpack.config.js')
-rw-r--r-- | config/webpack.config.js | 56 |
1 files changed, 48 insertions, 8 deletions
diff --git a/config/webpack.config.js b/config/webpack.config.js index 30900db62e7..9625ffddb0a 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -3,7 +3,8 @@ var fs = require('fs'); var path = require('path'); var webpack = require('webpack'); -var StatsPlugin = require('stats-webpack-plugin'); +var StatsWriterPlugin = require('webpack-stats-plugin').StatsWriterPlugin; +var CopyWebpackPlugin = require('copy-webpack-plugin'); var CompressionPlugin = require('compression-webpack-plugin'); var NameAllModulesPlugin = require('name-all-modules-plugin'); var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; @@ -61,10 +62,12 @@ var config = { pipelines_details: './pipelines/pipeline_details_bundle.js', pipelines_times: './pipelines/pipelines_times.js', profile: './profile/profile_bundle.js', + project_import_gl: './projects/project_import_gitlab_project.js', project_new: './projects/project_new.js', prometheus_metrics: './prometheus_metrics', protected_branches: './protected_branches', protected_tags: './protected_tags', + repo: './repo/index.js', sidebar: './sidebar/sidebar_bundle.js', schedule_form: './pipeline_schedules/pipeline_schedule_form_bundle.js', schedules_index: './pipeline_schedules/pipeline_schedules_index_bundle.js', @@ -122,18 +125,33 @@ var config = { test: /locale\/\w+\/(.*)\.js$/, loader: 'exports-loader?locales', }, - ] + { + test: /monaco-editor\/\w+\/vs\/loader\.js$/, + use: [ + { loader: 'exports-loader', options: 'l.global' }, + { loader: 'imports-loader', options: 'l=>{},this=>l,AMDLoader=>this,module=>undefined' }, + ], + } + ], + + noParse: [/monaco-editor\/\w+\/vs\//], }, plugins: [ // manifest filename must match config.webpack.manifest_filename // webpack-rails only needs assetsByChunkName to function properly - new StatsPlugin('manifest.json', { - chunkModules: false, - source: false, - chunks: false, - modules: false, - assets: true + new StatsWriterPlugin({ + filename: 'manifest.json', + transform: function(data, opts) { + var stats = opts.compiler.getStats().toJson({ + chunkModules: false, + source: false, + chunks: false, + modules: false, + assets: true + }); + return JSON.stringify(stats, null, 2); + } }), // prevent pikaday from including moment.js @@ -182,6 +200,7 @@ var config = { 'pdf_viewer', 'pipelines', 'pipelines_details', + 'repo', 'schedule_form', 'schedules_index', 'sidebar', @@ -205,6 +224,26 @@ var config = { new webpack.optimize.CommonsChunkPlugin({ names: ['main', 'locale', 'common', 'webpack_runtime'], }), + + // copy pre-compiled vendor libraries verbatim + new CopyWebpackPlugin([ + { + from: path.join(ROOT_PATH, `node_modules/monaco-editor/${IS_PRODUCTION ? 'min' : 'dev'}/vs`), + to: 'monaco-editor/vs', + transform: function(content, path) { + if (/\.js$/.test(path) && !/worker/i.test(path)) { + return ( + '(function(){\n' + + 'var define = this.define, require = this.require;\n' + + 'window.define = define; window.require = require;\n' + + content + + '\n}.call(window.__monaco_context__ || (window.__monaco_context__ = {})));' + ); + } + return content; + } + } + ]), ], resolve: { @@ -253,6 +292,7 @@ if (IS_DEV_SERVER) { config.devServer = { host: DEV_SERVER_HOST, port: DEV_SERVER_PORT, + disableHostCheck: true, headers: { 'Access-Control-Allow-Origin': '*' }, stats: 'errors-only', hot: DEV_SERVER_LIVERELOAD, |