webpacker 6.0.0.pre.2 → 6.0.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/jest.yml +5 -2
- data/.github/workflows/js-lint.yml +5 -2
- data/.github/workflows/rubocop.yml +1 -1
- data/.github/workflows/ruby.yml +17 -14
- data/.node-version +1 -1
- data/.rubocop.yml +106 -0
- data/CHANGELOG.md +36 -9
- data/CONTRIBUTING.md +1 -1
- data/Gemfile.lock +93 -90
- data/README.md +363 -107
- data/config/README.md +3 -0
- data/config/webpacker.yml +1 -0
- data/docs/deployment.md +9 -29
- data/docs/developing_webpacker.md +29 -0
- data/docs/troubleshooting.md +57 -25
- data/docs/v6_upgrade.md +75 -0
- data/gemfiles/Gemfile-rails-edge +1 -1
- data/gemfiles/Gemfile-rails.6.1.x +12 -0
- data/lib/install/config/webpacker.yml +5 -7
- data/lib/install/{javascript/packs → packs/entrypoints}/application.js +4 -3
- data/lib/install/template.rb +17 -10
- data/lib/tasks/webpacker/binstubs.rake +2 -2
- data/lib/tasks/webpacker/check_node.rake +3 -0
- data/lib/tasks/webpacker/check_yarn.rake +4 -1
- data/lib/tasks/webpacker/clobber.rake +1 -1
- data/lib/tasks/webpacker/install.rake +2 -2
- data/lib/tasks/webpacker/verify_config.rake +14 -0
- data/lib/tasks/webpacker/verify_install.rake +1 -11
- data/lib/webpacker.rb +1 -1
- data/lib/webpacker/commands.rb +2 -1
- data/lib/webpacker/compiler.rb +9 -3
- data/lib/webpacker/configuration.rb +19 -8
- data/lib/webpacker/dev_server.rb +6 -0
- data/lib/webpacker/dev_server_runner.rb +7 -2
- data/lib/webpacker/env.rb +5 -1
- data/lib/webpacker/helper.rb +26 -50
- data/lib/webpacker/instance.rb +4 -0
- data/lib/webpacker/manifest.rb +1 -2
- data/lib/webpacker/railtie.rb +1 -2
- data/lib/webpacker/runner.rb +1 -1
- data/lib/webpacker/version.rb +1 -1
- data/lib/webpacker/webpack_runner.rb +1 -0
- data/package.json +25 -29
- data/package/__tests__/development.js +3 -2
- data/package/__tests__/env.js +8 -4
- data/package/__tests__/index.js +9 -0
- data/package/babel/preset.js +24 -14
- data/package/env.js +7 -1
- data/package/environments/__tests__/base.js +7 -7
- data/package/environments/base.js +25 -25
- data/package/environments/development.js +7 -8
- data/package/environments/production.js +28 -30
- data/package/index.js +9 -2
- data/package/inliningCss.js +7 -0
- data/package/rules/babel.js +1 -1
- data/package/rules/coffee.js +5 -5
- data/package/rules/erb.js +5 -3
- data/package/rules/file.js +5 -3
- data/package/rules/index.js +9 -17
- data/package/rules/less.js +14 -10
- data/package/rules/raw.js +5 -0
- data/package/rules/sass.js +12 -9
- data/package/rules/stylus.js +26 -0
- data/package/utils/get_style_rule.js +28 -30
- data/package/utils/helpers.js +25 -0
- data/test/configuration_test.rb +3 -3
- data/test/dev_server_runner_test.rb +13 -2
- data/test/helper_test.rb +59 -60
- data/test/manifest_test.rb +16 -0
- data/test/mounted_app/test/dummy/config/webpacker.yml +4 -4
- data/test/test_app/app/{javascript/packs → packs/entrypoints}/application.js +1 -1
- data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.css +0 -0
- data/test/test_app/app/{javascript/packs → packs/entrypoints}/multi_entry.js +0 -0
- data/test/test_app/config/webpacker.yml +4 -6
- data/test/test_app/config/webpacker_other_location.yml +79 -0
- data/test/test_app/public/packs/manifest.json +19 -5
- data/test/webpacker_test.rb +17 -0
- data/yarn.lock +1567 -1039
- metadata +24 -36
- data/docs/assets.md +0 -135
- data/docs/cloud9.md +0 -310
- data/docs/css.md +0 -303
- data/docs/docker.md +0 -68
- data/docs/engines.md +0 -213
- data/docs/env.md +0 -68
- data/docs/es6.md +0 -72
- data/docs/folder-structure.md +0 -66
- data/docs/integrations.md +0 -220
- data/docs/misc.md +0 -23
- data/docs/props.md +0 -187
- data/docs/react.md +0 -183
- data/docs/target.md +0 -22
- data/docs/testing.md +0 -147
- data/docs/typescript.md +0 -190
- data/docs/v4-upgrade.md +0 -142
- data/docs/webpack-dev-server.md +0 -94
- data/docs/webpack.md +0 -315
- data/docs/yarn.md +0 -23
- data/lib/install/examples/vue3/app.vue +0 -27
- data/lib/install/examples/vue3/hello_vue.js +0 -15
- data/lib/install/javascript/packs/application.css +0 -9
- data/package/babel/preset-react.js +0 -62
- data/package/rules/svg.js +0 -23
data/docs/yarn.md
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# Yarn
|
2
|
-
|
3
|
-
Webpacker by default uses `yarn` as a package manager for `node_modules`
|
4
|
-
|
5
|
-
|
6
|
-
## Add a new npm module
|
7
|
-
|
8
|
-
To add any new JS module you can use `yarn`:
|
9
|
-
|
10
|
-
```bash
|
11
|
-
yarn add bootstrap material-ui
|
12
|
-
```
|
13
|
-
|
14
|
-
## Add an npm module to `devDependencies`
|
15
|
-
To add a new JS module that will only be available to local development:
|
16
|
-
|
17
|
-
```bash
|
18
|
-
yarn add --dev browser-sync
|
19
|
-
```
|
20
|
-
|
21
|
-
Be careful not to add any build or app related JS modules in this fashion. Adding JS modules to `devDependencies` [will block them from being installed in **any** production environment](https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-production-true-false).
|
22
|
-
|
23
|
-
Docs from JS modules may instruct you to use `--dev` or `devDependencies`, but this is generally under the assumption that you are using a `node.js` workflow.
|
@@ -1,27 +0,0 @@
|
|
1
|
-
<template>
|
2
|
-
<p>
|
3
|
-
{{ message }}
|
4
|
-
</p>
|
5
|
-
</template>
|
6
|
-
|
7
|
-
<script>
|
8
|
-
import { ref } from 'vue'
|
9
|
-
|
10
|
-
export default {
|
11
|
-
name: 'HelloWorld',
|
12
|
-
setup() {
|
13
|
-
const message = ref('Hello World')
|
14
|
-
|
15
|
-
return {
|
16
|
-
message
|
17
|
-
}
|
18
|
-
}
|
19
|
-
}
|
20
|
-
</script>
|
21
|
-
|
22
|
-
<style scoped>
|
23
|
-
p {
|
24
|
-
font-size: 2em;
|
25
|
-
text-align: center;
|
26
|
-
}
|
27
|
-
</style>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/* eslint no-console: 0 */
|
2
|
-
// Run this example by adding <%= javascript_pack_tag 'hello_vue' %> (and
|
3
|
-
// <%= stylesheet_pack_tag 'hello_vue' %> if you have styles in your component)
|
4
|
-
// to the head of your layout file,
|
5
|
-
// like app/views/layouts/application.html.erb.
|
6
|
-
// Create a div container with the id 'vue-app' <div id='vue-app'></div>
|
7
|
-
// It renders <p>Hello Vue</p> into it.
|
8
|
-
|
9
|
-
import { createApp } from "vue";
|
10
|
-
import App from "../app.vue";
|
11
|
-
|
12
|
-
document.addEventListener("DOMContentLoaded", () => {
|
13
|
-
const app = createApp(App);
|
14
|
-
app.mount("#vue-app");
|
15
|
-
});
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
Any CSS added to this file or imported from this file, e.g. `@import '../stylesheets/my-css.css'`,
|
3
|
-
will be included in the "application" pack. Any CSS imported from application.js or as part of the
|
4
|
-
application.js dependency graph, e.g. `import '../stylesheets/my-css.css'` will also be included
|
5
|
-
in the "application" pack.
|
6
|
-
|
7
|
-
To reference this file, add <%= stylesheet_pack_tag 'application' %> to the appropriate
|
8
|
-
layout file, like app/views/layouts/application.html.erb
|
9
|
-
*/
|
@@ -1,62 +0,0 @@
|
|
1
|
-
module.exports = function config(api) {
|
2
|
-
const validEnv = ['development', 'test', 'production']
|
3
|
-
const currentEnv = api.env()
|
4
|
-
const isDevelopmentEnv = api.env('development')
|
5
|
-
const isProductionEnv = api.env('production')
|
6
|
-
const isTestEnv = api.env('test')
|
7
|
-
|
8
|
-
if (!validEnv.includes(currentEnv)) {
|
9
|
-
throw new Error(
|
10
|
-
`Please specify a valid NODE_ENV or BABEL_ENV environment variable. Valid values are "development", "test", and "production". Instead, received: "${JSON.stringify(currentEnv)}".`
|
11
|
-
)
|
12
|
-
}
|
13
|
-
|
14
|
-
return {
|
15
|
-
presets: [
|
16
|
-
isTestEnv && [
|
17
|
-
'@babel/preset-env',
|
18
|
-
{
|
19
|
-
targets: { node: 'current' },
|
20
|
-
modules: 'commonjs'
|
21
|
-
}
|
22
|
-
],
|
23
|
-
(isProductionEnv || isDevelopmentEnv) && [
|
24
|
-
'@babel/preset-env',
|
25
|
-
{
|
26
|
-
useBuiltIns: 'entry',
|
27
|
-
corejs: '3.8',
|
28
|
-
modules: false,
|
29
|
-
bugfixes: true,
|
30
|
-
loose: true,
|
31
|
-
exclude: ['transform-typeof-symbol']
|
32
|
-
}
|
33
|
-
],
|
34
|
-
[
|
35
|
-
'@babel/preset-react',
|
36
|
-
{
|
37
|
-
development: isDevelopmentEnv || isTestEnv,
|
38
|
-
useBuiltIns: true
|
39
|
-
}
|
40
|
-
]
|
41
|
-
].filter(Boolean),
|
42
|
-
plugins: [
|
43
|
-
'babel-plugin-macros',
|
44
|
-
[
|
45
|
-
'@babel/plugin-proposal-class-properties',
|
46
|
-
{ loose: true }
|
47
|
-
],
|
48
|
-
[
|
49
|
-
'@babel/plugin-transform-runtime',
|
50
|
-
{
|
51
|
-
helpers: false,
|
52
|
-
regenerator: true,
|
53
|
-
corejs: false
|
54
|
-
}
|
55
|
-
],
|
56
|
-
isProductionEnv && [
|
57
|
-
'babel-plugin-transform-react-remove-prop-types',
|
58
|
-
{ removeImport: true }
|
59
|
-
]
|
60
|
-
].filter(Boolean)
|
61
|
-
}
|
62
|
-
}
|
data/package/rules/svg.js
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
/* eslint global-require: 0 */
|
2
|
-
/* eslint import/no-dynamic-require: 0 */
|
3
|
-
|
4
|
-
module.exports = {
|
5
|
-
test: /\.svg$/i,
|
6
|
-
type: 'asset/inline',
|
7
|
-
generator: {
|
8
|
-
dataUrl: (content) => {
|
9
|
-
let optimisedContent = content
|
10
|
-
|
11
|
-
try {
|
12
|
-
if (require.resolve('mini-svg-data-uri')) {
|
13
|
-
const svgToMiniDataURI = require('mini-svg-data-uri')
|
14
|
-
optimisedContent = svgToMiniDataURI(content.toString())
|
15
|
-
}
|
16
|
-
} catch (e) {
|
17
|
-
/* Work out what to print here */
|
18
|
-
}
|
19
|
-
|
20
|
-
return optimisedContent
|
21
|
-
}
|
22
|
-
}
|
23
|
-
}
|