##// END OF EJS Templates
js: move raw loader definition. Fixes odd bug in CE/EE injection.
ergo -
r3180:a5902294 default
parent child Browse files
Show More
@@ -1,11 +1,12 b''
1 1 const styleElement = document.createElement('dom-module');
2 import sharedCSS from 'raw-loader!./style-polymer.css';
2 // this will use raw-loader
3 import sharedCSS from './style-polymer.css';
3 4
4 5 styleElement.innerHTML =
5 6 `<template>
6 7 <style>
7 8 ${sharedCSS}
8 9 </style>
9 10 </template>`;
10 11
11 12 styleElement.register('shared-styles');
@@ -1,79 +1,83 b''
1 1 /* webpack.config.js */
2 2 require('style-loader');
3 3 require('css-loader');
4 4 var path = require('path');
5 5
6 6 const projectName = 'rhodecode-components';
7 7 let destinationDirectory = path.join(process.cwd(), 'rhodecode', 'public', 'js')
8 8
9 9 if (process.env.RC_STATIC_DIR) {
10 10 destinationDirectory = process.env.RC_STATIC_DIR;
11 11 }
12 12
13 13 // doing it this way because it seems that plugin via grunt does not pick up .babelrc
14 14 let babelRCOptions = {
15 15 "presets": [
16 16 ["env", {
17 17 "targets": {
18 18 "browsers": ["last 2 versions"]
19 19 }
20 20 }]
21 21 ],
22 22 "plugins": ["transform-object-rest-spread"]
23 23 }
24 24
25 25 module.exports = {
26 26 // Tell Webpack which file kicks off our app.
27 27 entry: {
28 28 main: path.resolve(__dirname, 'rhodecode/public/js/src/components/index.js'),
29 29 },
30 30 output: {
31 31 filename: 'rhodecode-components.js',
32 32 path: path.resolve(destinationDirectory)
33 33 },
34 34 // Tell Webpack which directories to look in to resolve import statements.
35 35 // Normally Webpack will look in node_modules by default but since we’re overriding
36 36 resolve: {
37 37 modules: [
38 38 path.resolve(__dirname, 'node_modules'),
39 39 ]
40 40 },
41 41 // These rules tell Webpack how to process different module types.
42 42 // Remember, *everything* is a module in Webpack. That includes
43 43 // CSS, and (thanks to our loader) HTML.
44 44 module: {
45 45 rules: [
46 46 {
47 test: /style-polymer.css/,
48 use: 'raw-loader'
49 },
50 {
47 51 // If you see a file that ends in .html, send it to these loaders.
48 52 test: /\.html$/,
49 53 // This is an example of chained loaders in Webpack.
50 54 // Chained loaders run last to first. So it will run
51 55 // polymer-webpack-loader, and hand the output to
52 56 // babel-loader. This let's us transpile JS in our `<script>` elements.
53 57 use: [
54 58 {loader: 'babel-loader',
55 59 options: babelRCOptions},
56 60 {loader: 'polymer-webpack-loader',
57 61 options: {
58 62 processStyleLinks: true,
59 63 }
60 64 }
61 65 ],
62 66 },
63 67 {
64 68 // If you see a file that ends in .js, just send it to the babel-loader.
65 69 test: /\.js$/,
66 70 use: {loader: 'babel-loader', options: babelRCOptions}
67 71 // Optionally exclude node_modules from transpilation except for polymer-webpack-loader:
68 72 // exclude: /node_modules\/(?!polymer-webpack-loader\/).*/
69 73 },
70 74 // this is required because of bug:
71 75 // https://github.com/webpack-contrib/polymer-webpack-loader/issues/49
72 76 {
73 77 test: /intl-messageformat.min.js/,
74 78 use: 'imports-loader?this=>window'
75 79 }
76 80 ]
77 81 },
78 82 plugins: []
79 83 };
General Comments 0
You need to be logged in to leave comments. Login now